4 things can cause this movement:
1- Worms. If she has not been dewormed in the past 6 months, I would simply deworm her.
2- Anal gland problem. You may be able to see if they need to be emptied but you cannot see if they are mildly infected. Only a vet can tell you that.
3- Foreign object. Your dog may be trying to pass something he swallowed although he should not have...
4- Personal pleasure
This is more likely in males.
1- Worms. If she has not been dewormed in the past 6 months, I would simply deworm her.
2- Anal gland problem. You may be able to see if they need to be emptied but you cannot see if they are mildly infected. Only a vet can tell you that.
3- Foreign object. Your dog may be trying to pass something he swallowed although he should not have...
4- Personal pleasure