Quick take
Choose UV when microbiological risk is the problem. Choose RO for dissolved-contaminant treatment at the drinking tap. Private wells can need both.
What UV does
UV disinfects water by exposing microorganisms to ultraviolet light. It does not remove hardness, metals, nitrate or sediment.
What RO does
RO removes many dissolved ions and selected contaminants but is not a substitute for proper whole-house disinfection when the source has microbial risk.
Private well scenario
A common well-water treatment train uses sediment/chemical treatment upstream, UV for microbiological control, and optional RO at the drinking tap for dissolved contaminants.