A UTI can be diagnosed by a healthcare practitioner based on symptoms, a physical examination, and a urine sample test to detect the presence of bacteria or white blood cells.