uti and pregnancy

Rose
I'm confused it burns when I pee and I don't wanna be dumb or anything but I heard uti is linked to pregnanancy I'm on the pill but it stings when I pee I changed my diet and my pee was different and better by I went off my diet one day and had sex and it came back I'm confused I need this cleared up ¿?