Uti question

This is going to be a weird question. Can you masterbate when you have a uti? I know you can't have sex and when I looked it up it was like "yeah you just can't have sex or anything like it" so I'm not sure if I should just trust it, like what's the difference between masterbating and sex? I just got my first UTI and I thought Azo and Cranberry juice would get rid of it and after a week I got a kidney infection and have to take 2 pills daily for 7 days and I haven't had sex in like two weeks so I'm like really in the mood. Now before anyone goes "omg you can't wait bla bla bla", I can wait...but I'm in the mood and just want to cum lol