The incorporation of renewable energy sources into the electrical system has resulted in power quality (PQ) concerns like voltage sag and voltage swell. These issues affect sensitive loads and pose challenges in power distribution networks. To address these challenges, a recently introduced device called the Dynamic Voltage Restorer (DVR) offers a unique solution. This research focuses on mitigating voltage sag and voltage swell using a DVR and a sliding mode controller based on a rotating sliding surface. The DVR, incorporating energy storage similar to a DC battery, plays a vital role in averting voltage sags and swells by injecting high voltage for a brief period. When the DVR is connected between the voltage source and the load through an injection transformer, it effectively enhances the load voltage within the power distribution system. In contrast to conventional methods that rely on the grid, this suggested approach enables the system to independently address PQ issues like voltage sag and swell. Through simulated investigations using MATLAB/Simulink R2018a, the effectiveness of the proposed technique is demonstrated. The solution exhibits a mitigation time of 2 milliseconds and maintains total harmonic distortion below 5%, meeting IEEE criteria. As a result, the proposed solution is proven to be more efficient, straightforward, dependable, and adaptable.