A dog has a small, sac-like gland on either side of the anus which secretes a particular scent. They are what dogs use, along with urine, to mark territory. Designed to empty naturally during defecation, the anal glands sometimes become impacted or abscessed, painful conditions that lead the dog to drag his behind across the floor, in an attempt to alleviate them. Cats can incur similar anal problems, but do so more rarely.
In most cases, the sacs can be manually squeezed to release the fluid and ease the blockage. Some pets may need medication or homeopathic remedies for inflammations.
A common misconception about the anal sacs is that they should be emptied frequently, so veterinarians squeeze them empty as a routine matter. That may increase the prospects of inflammation and impactions. The natural state is that these glands are not to be empty.