Can hemorrhoids cause an infection?

This is my first pregnancy and I’ve had issues with constipation. This time it cause my rectum to actually bleed and I saw blood. Won’t shit coming contact with a cut cause an infection?