We present an analysis of time-resolved, medium-resolution optical spectroscopic observations of UX Ursae Majoris (UX UMa) in the blue (3920–5250 Å) and red (6100–7200 Å) wavelength ranges that were obtained in 1999 April and 2008 March, respectively. The observed characteristics of our spectra indicate that UX UMa has been in different states during those observations. The blue spectra are very complex. They are dominated by strong and broad single-peaked emission lines of hydrogen. The high-excitation lines of He ii λ4686 and the Bowen blend are quite strong as well. All the lines consist of a mixture of absorption and emission components. Using Doppler tomography, we have identified four distinct components of the system: the accretion disc, the secondary star, the bright spot from the gas stream/disc impact region and the unique compact area of absorption in the accretion disc seen as a dark spot in the lower left-hand quadrant of the tomograms. In the red wavelength range, both the hydrogen (Hα) and neutral helium (He i λ6678 and He i λ7065) lines were observed in emission and both exhibited double-peaked profiles. Doppler tomography of these lines reveals spiral structure in the accretion disc, but in contrast to the blue wavelength range, there is no evidence for either the dark spot or the gas stream/disc impact region emission, while the emission from the secondary star is weak. During the observations in 1999, UX UMa showed many of the defining properties of the SW Sextantis stars. However, all these features almost completely disappeared in 2008. We have also estimated the radial velocity semi-amplitudes K1 and K2 and evaluated the system parameters of UX UMa. These estimates are inconsistent with previous values derived by means of analysis of white dwarf eclipse features in the light curve in different wavelength ranges.