A UHC filter suppresses the illumination of the background sky caused by artificial light. By contrast, the wavelengths primarily emitted by nebular celestial objects are allowed to pass through.
The effect for the observer is a significant increase in contrast. The use of a UHC filter is not only advisable in light-polluted areas. Contrast is increased even under dark skies.
For example, the diagram below shows the effect of a UHC filter using a UHC filter from the manufacturer Astronomik. The filter allows light in the spectral range emitted by nebular astronomical objects (e.g. the Orion Nebula) to pass through.
Such a curve is called a transmission curve. It indicates the wavelengths a filter will allow to pass through.