The microbes that cause bladder infections live on the outside of the body and sex does help them to get inside, usually in women rather than men, although that can happen too. Since that area tends to have more sugar in it in diabetics than in non diabetics. it's more of a risk. Bacteria LOVE sugar. Going for a wee is standard advice. It washes them out of the urethra.
I'd add to that. Drink a little unsweetend cranberry juice or take cranberry tablets. They help prevent the bacteria from getting a grip on the surface. Then get your blood glucose down as near normal [5] as you can and change your toilet hygiene method. Use flushable baby wipes as well as tissue.
You don't need to be shy about it. Most of us here are adults and the condition is common. Nearly all women have it sometime.
I can also say that if you have pain on passing urine, take a little bicarbonate of soda. It tastes FOUL, but reduces the acidity of the urine. Aspirin, being acidic makes the burning worse. And drink LOADS of water.
Hana