Why cats like to rub their butts:
1. Unclean cat litter causes cats to smell bad when they go to the toilet. If they don't empty their bowels completely before running out, they will wipe their bottoms on the ground to clean themselves.
2. When a cat has soft stools or diarrhea, there may be feces on its buttocks, so it will choose to rub it off on the ground.
3. Some cats have blocked anal glands. When this happens, the cat will rub against the ground to relieve the discomfort. 
The function of anal glands in cats who rub their buttocks:
1. When cats mark their territory, they may leave their anal gland fluid on some items or animals.
2. When cats are frightened, stressed, or emotionally tense, they will involuntarily release anal gland fluid to maintain their health.
3. When a cat defecates, its anal glands secrete fluid to help lubricate the intestines and prevent constipation.