UV lights purify wastewater by eliminating harmful microorganisms, making the treated water safer for release into the environment.