It's possible it's a few different things:
1. Anal fissure - small tear in the brittle skin of the anus.
They're awfully painful and require time to heal.
2. Hemorrhoids - vericose veins either internally or externally
Most of us know about them from pregnancy, but they're much more common when someone tries to pass a hard stool. I had them terribly when going through chemo.
3. He may simply not be able to articulate exactly what's going on. Our son will be 4 on Friday and still can't tell us when he's hungry. Perhaps he's using the word "sting" in place of something else that may require you to ask more questions for clarity.
One thing that can result from the pain is a condition called Encopresis. Our daughter has it thanks to a bout with constipation a few months ago. It's basically when they'll psychologically withhold the poop until it eventually leaks drying the stool even further. They literally have to be retrained to poop again.
I'd not recommend giving him anything until you've spoken with the pediatrician and gotten their recommendation. Even over the counter medications can be very inappropriately used. In our case, we do give our daughter 1/2 capful of Miralax/day, but that was only upon the Pediatrician's advice after many other, less invasive attempts to add fiber, liquid, etc. failed.
Good luck. Here's what the American Academy of Pediatrics has to say about the topic: