Photocatalysts with bactericidal capabilities are taken much more into consideration due to the water disinfection aside from water purification Therefore, a magnetically separable CoFe2O4/g-C3N4 nanocomposite has been synthesized via a simple in-situ chemical method, and its performance in degrading methylene blue (MB), methyl orange (MO), and phenol has been investigated. Multiple characterization techniques were conducted to confirm the successful synthesis of cobalt ferrite (CF), graphitic carbon nitride (CN), and cobalt ferrite/graphitic carbon nitride (CF/CN) nanocomposites. The microscopy images indicated a great reduction in the size of CF nanoparticles in nanocomposites. The magnetic characteristics were studied by a vibrating sample magnetometer (VSM). CF showed a high magnetization value (41.4 emu/g) and by compositing CF with CN, the nanocomposite also showed considerable magnetic properties. Optical properties of the photocatalysts were analyzed and the results denoted that heterostructure formation between CF and CN led to better light absorption, reduction in the band gap energy, and enhancement of charge carriers separation. Among the different synthesized nanocomposites, 400 mg/L of the CF/25 wt% CN nanocomposite showed the best photocatalytic activity in 180 min by degrading 100% of MB. The Mott-Schottky analysis and the results of scavenging experiments divulged the superoxide radicals as the main active species along with proposing a S-scheme mechanism on the degradation pathway for CF/CN nanocomposite. The optimized nanocomposite demonstrated high stability after three cycles by over 98% degradation of MB. Eventually, the antibacterial feature of CF/25CN nanocomposite was assessed against Escherichia coli and Staphylococcus aureus bacteria and resulted in a magnificent performance by reducing 99.9% of both bacteria in 30 min.