An undercoat rake will help pull out trapped dead hair and prevent matting in the first place. A fine tooth comb will help with mild mats. To help with more aggressive mats, you could try a spray in conditioner. Anything that's still resisting that, I would just cut out to avoid irritating the dog.
A lot of that matting on the butt and tail can be prevented by trimming it up in the first place, too. I have to trim up my dog's butt fluff and tail fluff in the spring because he's shedding, and its' usually wet and messy and muddy outside and the dog sits in it. It's easier to keep clean and tangle free when there's not quite so much there.