Novel excellent antibacterial agent and efficient photocatalyst direct dual Z-scheme ZnO–CeO2-Yb2O3 heterostructured nanocomposite and pristine ZnO, CeO2, and Yb2O3 were prepared via a simple co-precipitation technique. The X-ray diffraction spectra confirmed the formation of pristine ZnO, CeO2, and Yb2O3, and the existence of their peaks ZnO (hexagonal), CeO2 (cubic), and Yb2O3 (cubic) in the nanocomposite. The Scherrer, Williamson-Hall, and Size-Strain plot models were used to measure the microstructural parameters. The UV–vis spectroscopy revealed the energy bandgap 3.0 eV, evident that the grown nanocomposite is a good photocatalyst under sunlight. The formation of the ZnO–CeO2-Yb2O3 nanocomposite is further confirmed by Raman and Fourier transform infrared spectroscopy (FTIR). Current-Voltage (IV) measurements shown the ohmic nature of nanocomposite with high electrical behavior. Scanning electron microscopy (SEM) images revealed a cluster type morphology. The antibacterial activity was carried out for Escherichia coli and Staphylococcus aureus bacteria. The zone of inhibition (ZOI) showed higher antibacterial activity for E. coli bacteria. The nanocomposite showed the highest photocatalytic degradation efficiency against methylene blue as compared to rhodamine-B, methyl orange, cresol red, and safranin-O dyes under 40 min of sunlight illumination. The impact of various parameters on the photocatalytic activity of nanocomposite, including catalyst amount, dye concentration, and solution pH, was also investigated. The scavenger's experiments were performed to ascertain the reactive species and confirmed the mechanism based on Z-scheme. The recyclability test exhibits that the as-obtained nanocomposite has high stability and can be reusable for the 6th cycles.