You can tell you're in for a party when someone puts the words "anal" and "gland" together. It's a thing in your butt! As luck would have it, all kinds of mammals have anal glands, even you. Yours are probably adorable. I could just pinch them. As for dog anal glands, they're up in their little doggy butts and they perform an entirely important function, which is lubrication. Anal glands lube up dog poop. That's their basic function in a nutshell. They help that Alpo ease its way onto the lawn, and for the most part that works the way nature designed it to.
The problem with anal glands in a dog is that a dog's dook is supposed to be hard naturally, and as it works its way down the path to enlightenment, the anal glands ease the transition into the world. They're like greasy forceps helping give birth to a disgusting baby. But if the poop isn't hard enough, there isn't enough pressure on the glands. That means your dog is likely to start scooting its ass all over the carpet because its glands will continue to fill and possibly get impacted.
Now that we have some impacted anal glands, you may be wondering how this affects your life. Welcome to grossness. You need to empty those glands. The dog can't do it, because the dog doesn't have any fingers. You do. You and your fingers need to squeeze the almost literal s**t out of those things. Or you can pay a vet or a groomer to do it for you, but the point is: someone needs to squeeze natural, butt-smelling ass lube out of your dog's anus, and it'll need to be done as often as once per month.
As an added bonus, the smell that comes from a dog's glands, especially if your dog is impacted or having some health problems from them not draining properly, can run anywhere from something like a mackerel that's been stuffed with s**t to a series of snake farts that have settled inside your brain. It's really unpleasant.