The release of waste, including organic dyes from various industries, directly into water bodies significantly contributes to environmental pollution. Consequently, there is a need for photocatalytic materials that can effectively remove harmful pollutants from water, ensuring its purity and safety. Carbon-based photocatalysts have garnered significant attention in this context because of their exceptional stability, high conductivity, and very small band gap. In the current project, a series of CoS, Ni–CoS, and Ni–CoS/S-g-C3N4 with different concentrations of S-g-C3N4 were synthesized using a simple, efficient, and cost-effective co-precipitation technique, while S-g-C3N4 was constructed through a thermal degradation process using thiourea as a precursor. The produced photocatalysts underwent characterization utilizing sophisticated analytical methods including FTIR, XRD, SEM, and EDX. The photocatalytic degradation behavior of the prepared photocatalysts was assessed using a UV–visible spectrophotometer, and the doping of Ni-metal was found to significantly enhance the degradation rate of methylene blue (MB), a standard pollutant dye in the order of CoS < %8Ni–CoS <8%Ni–CoS@50 % S-g-C3N4.the maximum photocatalytic degradation was shown by the nanocomposites (8%Ni–CoS@50 % S-g-C3N4) i.e. 94 %. The EIS spectra for CoS, 8 % Ni–CoS, and Ni–CoS/50 % SCN were analyzed, and their antimicrobial effectiveness was evaluated.