The synthesis of graphitic carbon nitride/cadmium sulfide core-shell nanofibers has been studied for the improved photodegradation of methylene blue (MB) dye. The enhancement in photocatalytic activity in g-C3N4@CdS core-shell nanostructures has been increased by controlling the thickness of the CdS shell. Additionally, the favorable bandgap, suitable band positions, and high thermal stability played an important role to enhance the photodegradation rate of catalysts. g-C3N4@CdS core-shell nanofiber arrays were synthesized by using a simple two-step process. g-C3N4 nanofiber (gcnf) was synthesized by using a simple polycondensation method and followed by a surface modification step for the deposition of CdS nanoparticles. The characterization of core-shell nanofibers and their photocatalytic activity was examined by powder X-ray diffraction, UV-Vis spectrophotometer, FESEM, EDS, and TEM microscopy. g-C3N4@CdS core-shell nanofibers (gcnf/CdS, 0.38; gcnf/CdS, 0.19; and gcnf/CdS, 0.09) showed enhanced photocatalytic degradation efficiency of ~ 98% in 40, 50, and 70 min, respectively. Pristine g-C3N4 nanofibers and CdS nanoparticles displayed the photodegradation efficiency of ~ 98% in 100 and 170 min, respectively. gcnf/CdS, 0.38 core-shell nanofibers (0.38 M of citric acid), offered the highest photodegradation rate of 0.0624 min-1, which is ~ 2.5- and 3-fold higher than pristine g-C3N4 nanofibers and CdS nanoparticles, respectively. The increase in the photodegradation rate of the g-C3N4@CdS core-shell nanostructure is due to the synergetic effect of g-C3N4 and CdS. Thus, the present work highlights the enhanced photocatalytic activity and stability of g-C3N4@CdS core-shell nanofibers and found to be useful in energy harvesting and environmental remediation applications.