4 month old pain advice

Yesterday at 4 mo we’ll check up / shots I brought up that I think my boy is getting his first diaper rash. Dr said it looked like a beginning of a yeast infection on his butt. He gave me some ointment to put on and it looks as tho to be getting better. But now my baby keeps screaming. At first I thought his legs hurt from the shots but now I’m starting to think that when he pees it burns his rash. But the rash seems to be getting better

So my question is do you think it could be a uti??

He’s been like this all day and normally doesn’t cry

He normally sleeps 9p-9a and last he was up every 45 min crying and uncomfortable