A power distribution system that combines two or more sources of renewable energy, such as biomass, solar, hydro, or wind, to generate and provide electricity to customers is known as a Hybrid Renewable Energy Source-Based Distribution Source (HRES). In a distribution system based on HRES, Power Quality (PQ) enhancement is crucial to ensure the electricity offered by steady, dependable, and appropriate for both industrial and consumer loads. The PQ issues caused by the distribution system also include harmonics, voltage sags, and swells. Thus, the paper proposed a novel Unified Power Quality Conditioner (UPQC) with COATI-ZEBRA (COAZ)-based PID controller for improving PQ in HRES. The COAZ method improves the PID controller parameters for enhancing PQ performance, and the suggested controller alleviates these problems by adjusting the harmonics and voltage disturbances. The proposed COAZ algorithm is created based on the integrated characteristics and features of the Zebra Optimization Algorithm (ZOA) and Coati Optimization Algorithm (COA). To further strengthen system resilience and robustness, the COAZ-based PID controller is tested under varying load conditions and renewable energy input fluctuations, ensuring real-time adaptability. The framework is proven in MATLAB 2021b, and the recommended method's performance is assessed by risetime, settlingtime, settlingmin, settlingmax, peak, and peaktime, respectively. The suggested PID-based COAZ strategy obtained a minimal ratio of 0.3634 for RiseTime, which is less than that of other methods already in use, including COA of 0.36398, ZOA of 0.3637, and ZOA of 0.364, respectively. The proposed method for effective PQ enhancement is validated by comparing its performance to existing methods.