To investigate the association among lower urinary tract infection (UTI), the type and timing of antibiotic usage, and the subsequent risk of developing cancers, especially genitourinary cancers (GUC), in Taiwan. This retrospective population-based cohort study was conducted using 2009–2013 data from the Longitudinal Health Insurance Database. This study enrolled patients who were diagnosed with a UTI between 2010 and 2012. A 1:2 propensity score-matched control population without UTI served as the control group. Multivariate analysis with a multiple Cox regression model was applied to analyze the data. A total of 38,084 patients with UTI were included in the study group, and 76,168 participants without UTI were included in the control group. The result showed a higher hazard ratio of any cancer in both sexes with UTI (for males, adjusted hazard ratio (aHR) = 1.32; 95% confidence interval (CI) = 1.12–1.54; for females, aHR = 1.21; 95% CI = 1.08–1.35). Patients with UTI had a higher probability of developing new GUC than those without UTI. Moreover, the genital organs, kidney, and urinary bladder of men were significantly more affected than those of women with prior UTI. Furthermore, antibiotic treatment for more than 7 days associated the incidence of bladder cancer in men (7–13 days, aHR = 1.23, 95% CI = 0.50–3.02; >14 days, aHR = 2.73, CI = 1.32–5.64). In conclusion, UTI is significantly related to GUC and may serve as an early sign of GUC, especially in the male genital organs, prostate, kidney, and urinary bladder. During UTI treatment, physicians should cautiously prescribe antibiotics to patients.