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-C3N4/WO3-x Z-scheme heterojunction nanocomposites were fabricated using the pyrolysis method with bulk g-C3N4 and WO3 nanorods. Meanwhile, the bandgap edge of g-C3N4 is being fine-tuned, while the O(V)s in WO3 are deliberately engineered. Satisfactory results were achieved, wherein the photodegraded MO by the 2D g-C3N4/20.0 wt % WO3-x Z-scheme heterojunction nanocomposite was 6.36, 3.78, and 11.07 times higher than that of bulk g-C3N4, 2D g-C3N4, and WO3-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-C3N4 can attain a bandgap structure that matches the bandgap of WO3; second, WO3 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-C3N4 Z-scheme heterojunction nanocomposites through bandgap and O-V engineering for visible-light-driven wastewater purification.