The development of a novel TiO2/KNbO3/g-C3N4 photocatalyst for the degradation of sulfamerazine under artificial sunlight was investigated in this study, aiming to obtain a highly effective material through the formation of Z-scheme heterojunctions between the proposed semiconductors. The characterizations confirmed the formation of the intended heterojunctions in the ternary composite photocatalyst, as the presence of TiO2, KNbO3, and g-C3N4 was successfully verified. Furthermore, the coupling between the semiconductors in the form of the ternary photocatalyst led to structural, morphological, and optical modifications of the TiO2 base matrix, such as a higher specific surface area and larger visible light absorption. The optimized ternary material (TiO2-5% KNbO3-0.25% g-C3N4) exhibited the highest reaction degradation capacity for the sulfamerazine (SFMZ) in both solar (86.5% degradation) and visible light (60% degradation) tests, confirming a significant enhancement over the pure TiO2, which achieved 48% degradation under solar light and 10% degradation under visible light. This result was mainly attributed to the formation of Z-scheme heterojunctions between the semiconductors, which enhanced the charge-transport efficiency during photonic excitation. Lastly, the degradation pathway proposed using mass spectroscopy analysis indicated the formation of mainly less toxic intermediates, as estimated through quantitative structure-activity relationship (QSAR) predictions.