Hello,
An anal fissure, piles, Crohns disease, abscess all can produce
pain during motions. Anal
pain that
does not resolve with the use of over the counter medications within 24-48 hours needs to be investigated by a physician. Anal pain that lasts more than two weeks can be serious. In a STD there will be pain, bleeding, and/or discharge from anus. Consult a doctor. Treatment will depend on the underlying cause. Hope it helps.
Best luck and regards!