They kill bacteria and pathogenic germs within flowing open water of your tank. Most of the good/wanted bacteria of your tank is in substrate not in the water itself. Thus this is not negatively affects your tanks biological filter function. UV-sterilizers are no must, but have following advantages:
Part of the water of your tank is going through a thicker tube. Strong UV-Light exactly in the middle of this tube kills bacteria, germs, …. The more UV light and the longer water is running along, the better the sterilizing function. UV sterilizers should run 24haours a day not to allow bacteria/germs to re-populate. UV spectrum of the bulbs is reducing with age of the bulbs, so they should be replaced periodically (~1 year)
also bring several advantages :
Attention: to much ozone is giving several negative effects by to strong oxidation for your fish! (e.g. burns your fishes gills, …). Rule of thumb: ca. 10 mg Ozone per 100 Liter tank water
Ozonizers are best used within the air supply of your skimmer . It is recommend to convert the ozone generated to oxygen again by steadily using carbon after the skimmer. Adding a new ozonizer is leading to better skimming in the beginning. Attention: Ozone causes embrittlement of rubber and plastic parts.