Hard to tell what you are describing. It may be a prolapse and should be checked.
Sounds like a "express" (think that is what it is called) of the Anal glands would be worth a try. If you can't do it yourself a groomer may do it as part of a grooming - what $50 (depends on dog size and complexity) surely less than a vet check. If that doesn't work see a vet.