Sharp pains when passing stool?

Right before I pass stool I’ve been getting crazy sharp pains deep inside my rectum. It’ll last like 30 min, then I’ll have loose, yellow stools. I know it may sound funny but I actually screamed last night because of a pain. I kept feeling out of breath and faint during the 30 min as well. My heart was also racing. Is this a sign of something or am I okay? I didn’t want to go the doctor last night because the last time I went (I wasn’t there for pains like this) but I overheard them giggling about another patient who was like this. The hospital nearby me literally has the worst staff