Are you constipated? The puckered are at the opening to the anus is very sensitive and although it stretches a lot, sometimes when it stretches, it produces 1 or more small tears. Keep the area clean and put a little Polysporin on it It will help prevent infection and also keep the puckered area moist. You should see your doctor so he can confirm what I just said. I would hate for it to be something serious and I blew it off to hard turds. :)
I can't imagine how masturbating would lead to blood in your stool. If you have heavy blood in your stool, you need to go to the doctor. It's bright red? Do you have a history of hemorrhoids? Sometimes they can be attributed to red blood in stool. But that would be unlikely related to masturbating. Unless you aggravated it somehow. An anal fissure and masturbation may lead to blood in stool. But that seems doubtful too. Any way you can go to the doctor? If you stop masturbating for a few days, does it go away?