The diagnosis of a UTI is usually confirmed through a urinalysis, which checks for the presence of bacteria, white blood cells, and red blood cells in the urine. In some cases, a urine culture may be performed to identify the specific type of bacteria causing the infection and determine the most effective antibiotic treatment.