In a distribution system, to compensate for the effect of voltage sag/swell and mitigate harmonic currents, a unified power quality conditioner (UPQC) is used. Conventionally, the power rating of UPQC is determined based on the expected sag/ swell, linear and nonlinear loads. However, with the shift towards usage of electronic loads and electrical drives, the composition of nonlinear loads is increasing. Hence, the UPQC deployed earlier may not be capable of handling increased harmonic currents due to its limited current rating. While trying to compensate for both harmonic currents and voltage sag/swell, the shunt converter (of UPQC) may reach its current limit and would result in undesirable behaviour. To address this issue, a technique to prioritise sag/swell compensation over active filtering is proposed in this study. The remaining power capacity of UPQC (after sag/swell compensation) is utilised for harmonic filtering. Adaptive determination of harmonic compensation current also allows prioritising the various harmonics to be compensated. This helps in case passive tuned filters are installed for some harmonic frequencies for which UPQC need not respond. Detailed simulation studies are performed on MATLAB/SIMULINK platform and results are included in this study. A laboratory prototype of single phase UPQC is developed to validate the performance of the proposed scheme.