Hi,
Welcome to HCM.
The usual reason for this could be
abscess formed near anus which causing the brown and yellow mucus discharge mixed with blood through anus during bowel movements with pain over buttocks.
The another reason can be a mass or something inside or some intestinal worm or fissure or piles but it must be further evaluated by clinical examination and some relevant tests.
However,it is very unlikely to be related to your unprotected sex before 2 months,so no need to be worried about it.
So,you will need clinical examination by a surgeon - per
rectal examination which can help to find out the exact reason.
Routine blood works and stool examination for ova,
cyst and reducing substance should also be done.
You should take
albendazole 400 mg as a de-worming but for that,you will need prescription from some local doctor.
Consult surgeon who will know about all the tests and complete treatment.You will need to drain this abscess.
Regards,