Can you still get a UTI/Yeast infection after safe sex?

I hooked up with a guy a couple days ago and he used a condom. When i’ve peed it doesn’t sting but still hurts in a way? It was like I had to force myself to pee and it kind of ached (I don’t really know how to explain it.) I’ve gotten UTI’s/ yeast infections from unprotected sex but i didn’t know if it could still happen even with using a condom