Thanks for your question.
If there is blood after/during anal sex that could mean there was damage done to the rectum during penetration. The blood is generally caused by anal fissure. Most of the time, the fissure will cure by itself. If its doesn’t stop to bleed, I would suggest you to get medical attention to see what happened.
To avoid damage to the rectum during anal sex, use lube and a condom. Also, work whatever your using for penetration (fingers, hands, penis, dildo) in slowly. Don’t jam it all in at once, work it in a bit at a time.
Hope this was useful!