Females are up to 30 times more likely to get a UTI than males. This is due to two reasons: Firstly, the female urethra is close to the vagina and anus. This means that bacteria can easily spread from these areas to the urethra. Secondly, the urethra is shorter in females than it is in males. This means that bacteria that enter the urethra can reach the bladder more easily.
In women, peeing after sex can help to flush any bacteria away from the urethra.
For males, peeing after sex is less important. This is because males have a longer urethra. As a result, bacteria from the genital area is less likely to reach the bladder.
Although there is no solid evidence to confirm that peeing after sex can prevent UTIs, there is no harm in following this practice. It may help to reduce the risk of UTIs, especially in women and people who are more prone to UTIs.
Source Article from https://www.medicalnewstoday.com/articles/327380.php