Regulating the bandgap edge and building oxygen vacancy (O V ) engineering are effective countermeasures for facilitating interfacial charge carrier transfer/separation. Herein, bandgap-matched 2D g-C 3 N 4 /WO 3−x Z-scheme heterojunction nanocomposites were fabricated using the pyrolysis method with bulk g-C 3 N 4 and WO 3 nanorods. Meanwhile, the bandgap edge of g-C 3 N 4 is being fine-tuned, while the O V s in WO 3 are deliberately engineered. Satisfactory results were achieved, wherein the photodegraded MO by the 2D g-C 3 N 4 /20.0 wt % WO 3−x Z-scheme heterojunction nanocomposite was 6.36, 3.78, and 11.07 times higher than that of bulk g-C 3 N 4 , 2D g-C 3 N 4 , and WO 3−x , respectively. Additionally, the photoreduction of Cr (VI) of the former was 8.92, 5.23, and 14.76 times higher than that of the latter three, respectively. There are two primary reasons for the notable increase in the photocatalytic rate: first, through secondary pyrolysis, g-C 3 N 4 can attain a bandgap structure that matches the bandgap of WO 3 ; second, WO 3 can generate chippy O V active centers. Furthermore, the synergistic interaction between the two components generates additional interface charges and promotes increased photon absorption, ultimately enhancing the photocatalytic rate. This study offers insights into designing and constructing g-C 3 N 4 Z-scheme heterojunction nanocomposites through bandgap and O V engineering for visible-light-driven wastewater purification.