Introduction

Emerging pollutants that include pharmaceuticals, personal care, and pesticides are a major cause of water pollution and a huge health concern to all life on the planet. Thus, the remediation of these contaminants of emerging concern from wastewater is of paramount importance to the scientific community (Healy et al. 2017). The United States Environmental Protection Agency (USEPA) classified emerging pollutants as hazardous materials that are yet to have regulatory standards (Yahaya et al. 2019). Pathways of emerging pollutants into the environment (especially water) include human activities, agricultural activities, and industrial activities. Emerging pollutants are generally found in very low concentrations, and although their long-term effects are still relatively unknown, some of these pollutants are highly stable and hazardous in nature (Koiki et al. 2019). Examples of these pollutants are antibiotics like ciprofloxacin and sulfamethoxazole. Ciprofloxacin and sulfamethoxazole with concentrations of ~ 100 times higher as compared to other places have been detected in water in Africa and Europe (Fekadu et al. 2019). A United Nations Children’s Fund (UNICEF) survey indicated that ciprofloxacin is the drug with the highest number of existing manufacturers, followed by sulfamethoxazole (Fekadu et al. 2019). This is because both these drugs have low manufacturing process costs as compared to other drugs. This then leads to a wide usage of these antibiotics which in turn leads to high concentrations that have been detected as emerging pollutants in water.

Conventional methods for water treatment including chemical, physical, and biological processes were found to be less effective in treating these emerging pollutants. The reason for the low treatment efficiencies is that the chemical composition of sulfamethoxazole and ciprofloxacin is highly complex (Orimolade et al. 2020). This has issued a call in the scientific community for more efficient and effective techniques that will lead to the high removal of emerging pollutants. The genotoxicity of antibiotics in humans and aquatic organisms necessitates a complete removal using a more robust wastewater treatment method. Photocatalysis has been found to be very effective in the treatment of water. The remediation of wastewater using photocatalysis has been carried out with the use of catalysts such as ZnO, TiO2, and other metal oxide materials (Koiki et al. 2019; Orimolade et al. 2020; Zwane et al. 2020; Ramalingam et al 2022). Though very effective, these photocatalysts have been found to have disadvantages such as being activated under ultraviolet (UV) illumination only and may exhibit decreased photocatalytic activity because of the presence of decreased surface area, rapid charge recombination, toxic chemicals being released in Cd2+ leaching from CdS, and a steep cost for fabrication as most utilize noble metals (Li et al. 2021). Hence, there’s a continuous need to search for new materials and strategies that can be utilized for the improvement of photocatalytic effectiveness. The utilization of carbonaceous materials such as g-C3N4 has attracted worldwide attention because of its outstanding properties. Graphitic carbon nitride is a π-conjugated polymer material that mostly occurs in the 2D form and has high thermal and chemical stability owing to the C3N4 ring present in its structure. Furthermore, g-C3N4 is non-toxic in nature, convenient to synthesize, and photocatalytic under visible light. This is because of its distinguished band positions of g-C3N4 such as ∼− 1.07 eV for the conduction band, ∼1.83 eV for the valence band, and ∼2.8 eV band gap (Chai et al. 2017; Raghava et al. 2019).

However, the literature has shown that pristine carbon catalysts such as g-C3N4 have relatively poorer catalytic activity because of disadvantages such as low absorption range toward visible light. This is due to the high stability and graphitization degree found in the g-C3N4 which leads to a high recombination rate (Chen et al. 2019). Thus, doping of g-C3N4 with different elements such as nitrogen and phosphorus to increase its photocatalytic performance has been explored to improve these shortfalls. This is because doping with these elements enhances photocatalytic properties by decreasing the electron mobility within the graphitic carbon nitride structure to avoid the recombination of electron holes. This then corrects the high recombination rate by increasing the levels of conduction band energy and the valence band energy. For example, a study was conducted by Wang et al. on a co-doped Fe and S g-C3N4 for the degradation of sulfamethoxazole. In contrast to the pristine g-C3N4, the Fe- and S-doped g-C3N4 achieved over 80% degradation efficiency. This was attributed to the partial replacement of nitrogen atoms with S and Fe which led to the generation of hydroxyls that were able to degrade the sulfamethoxazole pollutant (Wang et al. 2020). In line with this, Chuaicham and co-workers illustrated the effectiveness of doping g-C3N4 with oxygen for the degradation of ciprofloxacin (Chuaicham et al. 2021). The photocatalytic activity for the O-doped g-C3N4 was found to be significantly higher (95%) than that of pristine g-C3N4 (62%). The superior degradation performance of the O-doped g-C3N4 was attributed to the extended life of the charge carrier and electron holes. This is because doping with oxygen shifted the band gap of the g-C3N4 from 2.82 to 2.73 eV. Moreover, Gasim et al. 2023 prepared an N- and S-co-doped g-C3N4 toward the degradation of ciprofloxacin. In this study, it was observed that the incorporation of both N and S reacted synergistically to excite C atoms, aiding in the successful degradation of ciprofloxacin. This was accompanied by degradation intermediate products with m/z 362, 291, 263, 181, and 167, respectively (Gasim et al. 2023). Furthermore, a recent study on the effectiveness of co-doping of g-C3N4 was undertaken by Hasija and co-workers in which 99.4% of sulfamethoxazole degradation efficiency was achieved after doping with O and S. This was also attributed to the induced nitrogen vacancies in graphitic carbon nitride that arise due to the replacement with O and S (Hasija et al. 2023). Although results in these studies have shown that doping with these elements increases catalytic performance, the preparation of nitrogen and co-doping of g-C3N4 requires extremely high temperatures for the synthetic process. Also, co-doping leads to the increase in the graphitization of the material which makes the framework of g-C3N4 to be well-packed and form strong bonded C atoms. This creates a challenge in the penetration of heteroatoms and hence to be less successfully doped within the graphitized structure. Furthermore, the stability and reusability of the S-, O- and N-co-doped g-C3N4 photocatalysts have been found to significantly drop, making their practical application questionable without needing further regeneration.

Another element that has gained attention as a dopant for graphitic carbon nitride is phosphorus. This is because phosphorus is electron rich as it contains an equivalent number to nitrogen in its valence electrons (Patel et al. 2016). The C–P bond polarity is polar to the C–N bond because phosphorus atoms possess lower electronegativity (2.19) than carbon atoms (2.55), making phosphorus partially positively charged. This leads to the C–P bond being the catalytic site, instead of the neighboring carbon atoms found in the carbon samples doped with nitrogen (Patel et al. 2016). Moreover, the diameter of phosphorus is larger than carbon and this leads to P-doping distortion of the hexagonal carbon framework. The doping of g-C3N4 with phosphorous has led to a wide application of g-C3N4. For example, P-g-C3N4 leads to advantages such as enhanced visible light degradation, charge separation, active edge sites, and thus photocatalytic activity (Cai et al. 2022). This was seen in a recent study conducted by Li et al., where P-g-C3N4 achieved a remarkable degradation efficiency of 99.4% for diclofenac in contrast to pristine g-C3N4 which only achieved 21.3% (Li et al. 2022). The incorporation of phosphorus in the P- and O-co-doped g-C3N4 for the degradation of 2-chlorophenol was observed to boost the charge separation efficiency by lowering the band gap (Zhang et al. 2023a, b). Furthermore, the adsorption of oxygen molecules at phosphorus sites contributed to the production of extensive oxygen radicals that were able to completely degrade 2-chlorophenol pollutant in 30 min. This phenomenon was also seen in a study by Zhang et al. (2023a, b) in the degradation of tetracycline. The P-g-C3N4 achieved 100% within 60 min compared to the 60% for undoped g-C3N4 (Zhang et al. 2023a, b). Aside from degradation, P-g-C3N4 has been used as a photocatalyst in the generation of hydrogen as renewable energy. This was shown in a study conducted by Wang et al., when water was irradiated with a light source, 10.985 mmol/g of hydrogen was generated after 5 h, which was 7.6 times more compared to when pristine g-C3N4 was utilized. This was attributed to the efficient charge transfer that occurs during irradiation with light which enhances the photocatalytic performance of the P-g-C3N4 photocatalyst (Wang et al. 2022). Moreover, P-g-C3N4 demonstrated better adsorbent properties than pristine g-C3N4 when used in the removal of methylene blue (Chegeni and Dehghan 2020). Furthermore, a recent study by Kesavan et al. demonstrated that P-doped g-C3N4 can also be utilized as an excellent quercetin sensor for fruits. This study achieved 95% recovery of quercetin in the commercially available fruit juice samples (Kesavan et al. 2022).

As shown in the examples above, P-g-C3N4 has found application in the photocatalytic removal of organic in water, renewable energy generation, as a sensor, and as an adsorbent for pollutant uptake in water. The wide application has resulted in various review articles on doped g-C3N4 (Ahmadi et al. 2023; Lin et al. 2023; Wudil et al. 2023). The preparation of P-g-C3N4 using phosphoric acid and its use in degrading organic pollutants is in its infancy. Furthermore, due to the outlined advantageous results of phosphorus doping, the P-g-C3N4 photocatalyst is envisaged to effectively photodegrade ciprofloxacin and sulfamethoxazole in the visible region. Thus, the main objectives of the study were to prepare, characterize, and apply P-g-C3N4 in the removal of pharmaceuticals (ciprofloxacin and sulfamethoxazole). The successful doping of the P-g-C3N4 was confirmed through SEM–EDX analysis and the change in band gap which was calculated using Tauc plots. The effect of different percentages of P doping for the band gap of g-C3N4 and its degradation efficiency were studied. Furthermore, the study, unlike most reports on degradation, sought to shed more light on the active species in the degradation process, pathways, and by-products employing the use of LC–MS. Reusability and stability of the photocatalyst were also carried out. The synthesized photocatalyst exhibited high photocatalytic performance toward sulfamethoxazole and ciprofloxacin in contrast to undoped g-C3N4. Furthermore, the P-g-C3N4 was stable after five cycles of use without further regeneration.

Materials and methods

Materials

Melamine (analytical standard, C3H6N6), orthophosphoric acid (ACS reagent, ≥ 85%, H3PO4), ciprofloxacin (≥ 98.0% (HPLC), C17H18FN3O3), sulfamethoxazole (analytical standard, C10H11N3O3S), and formic acid (analytical standard, HCOOH) were acquired from Sigma-Aldrich (South Africa). These chemicals were utilized with no further purification.

Synthesis of g-C3N4 and P-g-C3N4

The pristine g-C3N4 was prepared by calcinating melamine (10 g) in a muffle furnace at 550 ºC temperature at the heat rate of 2 °C/min for 3 h (Dong et al. 2015). The pristine g-C3N4 was then ground and stored for further analysis. The P-g-C3N4 was prepared by a calcination method adopted from Chegeni and Dehghan (2020). Melamine (5 g) was dissolved in 100 mL aqueous phosphoric solution at different compositions (2%, 4%, 6% w/v). These mixtures were stirred at 25 °C for 1 h, and the resultant samples were placed in the oven at 80 °C overnight. The synthesis was completed by calcining the samples in a muffle furnace of 550 °C temperatures for 1 h. Furthermore, the g-C3N4 and P-g-C3N4 products were ground into powder and stored.

Characterization

The functional groups for g-C3N4, 2%P-g-C3N4, 4%P-g-C3N4, and 6%P-g-C3N4 were characterized using a Bruker FTIR Alpha spectrometer. The samples were mounted on an ATR and measured between the range of 400 to 4000 cm−1 of 32 scans averaged in a spectral resolution of 4 cm−1. The surface morphology of the g-C3N4, 2%P-g-C3N4, 4%P-g-C3N4, and 6%P-g-C3N4 was studied using scanning electron microscopy (TESCAN Vega TC, Czech Republic). The analysis was conducted by placing samples on a carbon tape followed by coating them with carbon. The images were analyzed at a high voltage of 20 kV and a secondary electron (SE) detector. An X-ray detector was paired with the TESCAN (SEM), and the detected energy-dispersive X-ray measurements were operated at 5 kV. In this study, EDX was used for elemental composition and mapping analysis of phosphorus, carbon, oxygen, and nitrogen in P-doped g-C3N4.

Optical properties of the g-C3N4, 2%P-g-C3N4, 4%P-g-C3N4, and 6%P-g-C3N4 were analyzed using UV–Vis diffusive reflectance spectrophotometer (Shimadzu UV-2450) (Kyoto, Japan) using BaSO4 as a reference. The collected data from the spectra were interpreted to get the absorption capacity of the samples and band edge potentials and to calculate the band gap. The extent of graphitization and crystallinity of g-C3N4, 2%P-g-C3N4, 4%P-g-C3N4, and 6%P-g-C3N4 was determined using an X-ray diffractometer on Rigaku min-flex 600 diffractometer (Rigaku Ultima IV, Japan). The scans were done with a step size of 0.02°/s of 2θ in the angle range between 10° and 80°.

Photocatalytic measurements

The photocatalytic efficiencies of g-C3N4, 2%P-g-C3N4, 4%P-g-C3N4, and 6%P-g-C3N4 were deduced from the percentage degradation of ciprofloxacin and sulfamethoxazole underneath a simulated solar irradiation. The photocatalysts (0.1 g) were distributed in 100 mL of the aqueous solution comprising 10 mg/L of the antibiotics. A glass quartz photoreactor was placed at 10 cm facing the incident light of the simulator horizontally. Aliquots were obtained using intervals of 30 min for 180 min by a syringe. The aliquots were filtered by applying a 0.22 μm PVDF filter to eliminate the photocatalyst. UV–visible spectrophotometer was then used to measure the degradation of sulfamethoxazole and ciprofloxacin in the supernatant solutions λ = 270 nm and λ = 256 nm, respectively (Zwane et al. 2020).

Scavenger, reusability, and stability experiments

Scavenger studies were conducted using 5 mM ethylenediamine tetraacetate salt (EDTA) and 5 mM t-butanol (t-BuOH) to inhibit the influence of holes and hydroxyl radicals, respectively, on the photocatalytic experiment of sulfamethoxazole. Reusability studies were conducted by using 2%P-g-C3N4 for 5 degradation cycles of sulfamethoxazole without pretreating the catalyst. The stability test was determined using XRD to analyze 2%P-g-C3N4 before and after 5 photocatalytic degradation cycles.

Ultra-performance liquid chromatography analysis

The optimized photocatalyst composition of 2%P-g-C3N4 obtained in “Photocatalytic measurements” section was applied for the determination of the degradation pathways and by-products formed during the photodegradation of ciprofloxacin and sulfamethoxazole. Waters Synapt G2-Si quadrupole time-of-flight mass spectrometer that was fitted with a photodiode array detector (200–600 nm) was utilized. The instrument's settings and conditions were as previously reported (Zwane et al. 2020) as follows: Waters BEH C18 column (2 × 100 mm) was used to achieve separation. A flow rate of 0.3 mL/min was used, and the column temperature was regulated at 55ºC with an injected volume of 2 µL. The experimental data were extracted using a low scan for collision energy (6 V) with an m/z range being 150 to 1 500 and a high energy for collision scan (30–60 V) with m/z ranging from 40 to 1 500. The scan for the photodiode array detector was maintained at 220–600 nm. Optimized sensitivity parameters were used; these were cone voltage at 15 V, desolation gas which was nitrogen at 650 L/h, and desolation temperature at 275ºC. The negative mode for electrospray ionization was applied for the entire operation of the instrument.

Results and discussion

FTIR analysis

Figure 1 depicts the FTIR spectra of g-C3N4, 2%P-g-C3N4, 4%P-g-C3N4, and 6%P-g-C3N4. The peaks displayed at 1200, 1400, and 1610 cm−1 are designated to aromatic C=N, –C–N, and C=N functional groups, respectively, found in g-C3N4. Stretching peaks at 700 and 800 cm−1 are attributed to the breathing mode of the heptazine unit within the g-C3N4 (Guo et al. 2019). The broad peaks at 3120 and 3160 cm−1 assigned to OH and N–H, respectively, are due to the uncondensed amino group (–NHx) together with the water molecules that are adsorbed by samples (Zhang et al. 2021). The spectrums for g-C3N4 and different compositions of P-g-C3N4 didn’t show much difference due to the small amount of phosphorus used for doping. These results were consistent with those in previous studies where N–H, OH –C=N, C–N, and C=N, were observed at 3100, 1200, 1400, 1600, and 804 cm−1, respectively. These were also attributed to the C–N bond, amino group, and heptazine unit present in the g-C3N4 (Hu et al. 2019).

Fig. 1
figure 1

FTIR analysis for g-C3N4, 2%P-g-C3N4, 4%P-g-C3N4 and 6%P-g-C3N4

SEM–EDS analysis

The morphology of g-C3N4, 2%P-g-C3N4, 4%P-g-C3N4, and 6%P-g-C3N4 is illustrated in Fig. 2A–D. The surface morphology for the pristine g-C3N4 displayed spherical nanospheres. However, after doping with phosphorus, the morphology shows aggregates comprising different crystals stacking layers with small holes. These morphologies were consistent with those in previous studies by Wang et al. (2015), Hu et al. (2019) and Hasija et al. (2023) where the doping of pristine g-C3N4 with P and O led to crystal-like aggregates and an increase in the number of small holes. This increase in the small holes shows an amplify of the active edge sites in the doped g-C3N4 (Zhang et al. 2021). It should be noted that the presence of these active edge sites isn’t as clearly defined when doping with other elements like O and S, making the active edge site in these doped g-C3N4 limited (Wang et al. 2020; Chuaicham et al. 2021; Hasija et al. 2023). EDX analysis was also performed to validate that the P-doping of g-C3N4 had been successful (Fig. 2A′–D′). The EDX analysis displayed the presence of C, O, and N for pristine g-C3N4 at 0.3, 0.4, and 0.50 keV, respectively. After doping with phosphorus, N, O, C, and P are displayed at 0.2, 0.4, 0.5, and 2.0 keV, respectively, for 2%P-g-C3N4 and 4%P-g-C3N4. For 6%P-g-C3N4 the presence of C, O, N, and P is detected at 0.1, 0.2, 0.5, and 2.0 keV. The presence of phosphorus at 2.0 keV confirmed the successful doping of g-C3N4. It can also be denoted that the intense peak for phosphorus in the P-doped g-C3N4 in contrast to carbon in pristine g-C3N4 may be due to the phosphorus atoms replacing the carbon atom in the framework to form a P–N bond. This leads to phosphorus being an n-type dopant as it possesses more valence electrons in contrast to the carbon it is replacing within the framework (Majima et al. 2017). A similar study reported by Li et al. (2022) also showed that the detection of phosphorus by EDX is an indication that it was indeed doped into the g-C3N4 (Li et al. 2022) (Fig. 3).

Fig. 2
figure 2

SEM micrograph (A-D) and corresponding EDX analysis (A′-D′) of A g-C3N4, B 2%P-g-C3N4, C 4%P-g-C3N4 and D 6%P-g-C3N4

Fig. 3
figure 3

SEM–EDS mapping for 2%P-g-C3N4

UV–Vis DRS analysis

The optical properties of g-C3N4 and different compositions of P-g-C3N4 were analyzed using UV–Vis diffuse reflectance spectra and the results are displayed in Fig. 4A and B. The prepared g-C3N4, 2%P-g-C3N4, 4%P-g-C3N4, and 6%P-g-C3N4 showed a visible absorption edge at 430, 435, 440, and 450 nm, respectively. With the incorporation of the P element in the g-C3N4 composite, the 2%P-g-C3N4, 4%P-g-C3N4, and 6%P-g-C3N4 samples showed an increase in the absorption intensity from 430 to 450 nm and the absorbance of the P-g-C3N4 was higher throughout in the visible range. This better light absorption in the visible range is assigned to the P–N bond that was formed when the C elements were substituted with P elements. This proved that phosphorus as a dopant can increase the light absorption capacity of g-C3N4 which leads to the enhancement of the generation of photogenerated electrons and holes that improve the photocatalytic activity of the material. The band gaps were calculated using Eq. 1 (Zwane et al. 2020).

$${(ahv)}^{n} = A(hv - Eg)$$
(1)

whereby a denote the absorption coefficient, represents light energy, a constant is represented by A, Eg illustrates the optical band gap energy, while n equals 2 for a direct band gap and 1/2 for an indirect band gap (Zwane et al. 2020). The band gap values, from a plot of (ahv)1/2 vs. hν, were estimated to be ± 2.7 eV for g-C3N4, ± 2.48 eV for 2%P-g-C3N4, ± 2.46 eV for 4%P-g-C3N4, and ± 2.45 eV for 6%P-g-C3N4. The lowered band gap (from 2.7 to 2.45 eV) observed is attributed to the introduction of the donor state, which is composed of phosphorus 2p orbitals. The presence of the 2p orbitals in the doped g-C3N4 effectively enhanced the light-harvesting ability in comparison to pristine g-C3N4. This leads to the improvement of visible light absorption in comparison to pristine g-C3N4. Numerous studies also support the lowering of the band gap of g-C3N4 after doping with other atoms, and some of these are shown in Table 1. According to Hassija et al., the band gap of S- and O-doped g-C3N4 was lowered from 2.76 to 2.6 eV (Hasija et al. 2023). Zang et al. reported a decrease in a bad gap from 2.76 to 2.33 eV when g-C3N4 was co-doped with oxygen and phosphorus. Moreover, in a similar study, the O-doped g-C3N4 band gap was slightly lowered from 2.82 to 2.73 eV (Chuaicham et al. 2021). Also, the band gap of Pt-doped g-C3N4 was lowered from 2.85 to 2.7 eV (Wu et al. 2023). P-g-C3N4 photocatalyst prepared in this study achieved a much-reduced band gap of 2.45 eV for a single-atom-doped g-C3N4, thus suggesting that it will have high separation efficiency and prolonged life for the electron holes and photogenerated charge carriers in comparison to sulfur-, oxygen-, and platinum-doped g-C3N4.

Fig. 4
figure 4

A UV–Vis DRS and B band gap edges for g-C3N4, 2%P-gC3N4, 4%P-g-C3N4, and 6%P-gC3N4

Table 1 Comparison of bandgaps for g-C3N4 doped with different atoms between this work and literature

XRD analysis

Figure 5 illustrates the XRD analysis of g-C3N4, 2%P-g-C3N4, 4%P-g-C3N4, and 6%P-g-C3N4. The peaks at 2θ = 13.2° (001) and 27.5° (002) are because of the crystal phase of g-C3N4 (JPCD no 00-066-0813) (Chuaicham et al. 2022). These planes also appear for the doped 2%P-g-C3N4, 4%P-g-C3N4, and 6%P-g-C3N4. These correspond to the crystal phase of g-C3N4 associated with g-C3N4. The peaks at 13.2° and 27.5° did not shift or change after doping with phosphorus, revealing that the g-C3N4 structure was retained after doping. However, it should be noted that the peak at 13.2° (001), though reported, is significantly weaker in this study as has been found in other studies (Majima et al. 2017; Li et al. 2022) where low intensity and unchanged peak position after P-doping were observed. This is because the increase or decrease in the crystallinity of g-C3N4 depends on the method of preparation (Wudil et al. 2023). Also, the peaks at (002) are broader in this study, and generally a broader (002) plane peak points to less graphitization within the carbonaceous material which is ideal as it solves the challenge of recombination rate that is experienced when graphitization is high, which is one of the disadvantages of pristine g-C3N4 (Gasim et al. 2023). Hence it may be suggested that the doped elements and in this case phosphorus may be attached randomly on the surface.

Fig. 5
figure 5

XRD patterns for g-C3N4, 2%P-g-C3N4, 4%P-g-C3N4 and 6%P-g-C3N4

Photodegradation studies

Figure 6A and B shows the photodegradation of ciprofloxacin and sulfamethoxazole, respectively. The results illustrate that 2%P-g-C3N4 obtained the highest degradation for both pollutants which was followed by 4%P-g-C3N4, then 6%P-g-C3N4, and lastly g-C3N4. The degradation efficiency was 70% and 60% for sulfamethoxazole and ciprofloxacin, respectively, after 3 h when using 2%P-g-C3N4. However, it can be noted that when doping percentages were increased to 4% and 6% the photocatalytic activity was not as effective as when doping was 2%. This is because increasing the doping percentages may lead to agglomeration and the blocking of some photocatalytic sites in the g-C3N4 structure. The increase in performance for 2%P-g-C3N4 is assigned to the rationale that doping creates alternative energy pathways which decreases the chances for the electron holes and electrons recombining within the g-C3N4. Catalyst generally provides pathways of lowered energy for a reaction to occur. The reduction in band gap and improved photocatalysis therefore suggest that the phosphorous doping may be providing an alternative mechanism of degradation (which can be through an alternative energy pathway) of the pollutant. Furthermore, the improved photocatalysis can be due to a more sluggish electron–hole recombination rate because of the phosphorous dopant. These results were similar to studies reported before, whereby the doping of g-C3N4 increased degradation by reducing the recombination rate of the carbon catalyst. For example, Wang et al. observed an increase in the removal of sulfamethoxazole from 41 to 71.5% after doping g-C3N4 with sulfur and iron oxide (Wang et al. 2020). This is because the incorporation of another element destabilizes the stability of the g-C3N4 and increases the conduction band, which inhibits the mobility of the electrons and thus increases the photoactivity of the photocatalyst.

Fig. 6
figure 6

Photodegradation of A CIP and B SMX using g-C3N4 and 2%P-g-C3N4, 4%P-gC3N4, and 6%P-g-C3N4

Proposed degradation mechanism, scavenger studies, reusability, and stability

To investigate the contribution of free radicals in photodegradation, a simple scavenger test was conducted, and the results are displayed in Fig. 7a. It can be noted that when tertiary butanol (t-BuOH) was used to inhibit the effect of hydroxyls on the degradation, the results decreased slightly from 70 to 59%. This implied that the hydroxyl radical’s contribution in the degradation experiment was less and is described as a minor oxidant. In contrast, when disodium salt of ethylenediaminetetraacetic acid (EDTA) was employed to inhibit the electron holes, the degradation efficiency dropped drastically to 21%, suggesting that the holes played a major role in the degradation of sulfamethoxazole and as such defined as the major oxidant. From these results, the possible mechanism of degradation can be deduced as follows: during visible light illumination of 2%P-g-C3N4, excitation occurs in the g-C3N4 to generate electrons and holes. The phosphorus then acts as an electron acceptor, as it attracts and transfers the photogenerated electrons and this leads to the inhibition of the electron–hole recombination. The electrons can also react with dissolved oxygen from water to form superoxide which reacts with protons to form hydroperoxide radicals that degrade sulfamethoxazole and ciprofloxacin. The holes on the other hand react with water molecules to produce hydroxyl radicals. The hydroxyl radicals together with the remaining holes further degrade ciprofloxacin and sulfamethoxazole to CO2 and H2O. The proposed photocatalytic activity mechanisms for CIP and SMX are listed in Eqs. 28:

Fig. 7
figure 7

A Scavenger studies for the degradation of sulfamethoxazole using 2%P-g-C3N4 B Reusability experiments for the degradation of sulfamethoxazole using 2%P-g-C3N4 and C Stability experiments: XRD patterns before and after degradation

$${\text{P}}-{\text{g}}-{{\text{C}}}_{3}{{\text{N}}}_{4}+{\text{hv}}\to {{\text{e}}}^{-}+{{\text{h}}}^{+}$$
(2)
$${{\text{e}}}^{-}+ {{\text{O}}}_{2}\to \dot\,{{\text{O}}}_{2}^{-}$$
(3)
$${{\text{O}}}_{2}^{-} + 2{{\text{H}}}^{+} + {{\text{e}}}^{-} \to {{\text{H}}}_{2}{{\text{O}}}_{2}$$
(4)
$${{\text{H}}}_{2}{{\text{O}}}_{2}+ {{\text{e}}}^{-}\to \dot\,{\text{OH}}+{{\text{OH}}}^{-}$$
(5)
$${{\text{h}}}^{+}+ {{\text{H}}}_{2 }{\text{O}}\to \dot\,{\text{OH}}+{{\text{H}}}^{+}$$
(6)
$${\text{CIP}}+\left({{\text{h}}}^{+}+\dot\,{\text{OH}}+{\dot\,{\text{O}}}_{2}^{-}\right)\to {\mathrm{Oxidation\;products}}$$
(7)
$${\text{SMX}}+\left({{\text{h}}}^{+}+\dot\,{\text{OH}}+{\dot\,{\text{O}}}_{2}^{-}\right)\to {\mathrm{Oxidation\;products}}$$
(8)

Figure 7B shows the results for the reusability of 2%P-doped g-C3N4 during 5 cycles. It can be noted that there was a slight decrease in the degradation efficiency of sulfamethoxazole as it decreased from 72 to 65% after 5 cycles. The loss in efficiency was 10%, which suggested that this catalyst can be reused after several cycles. In other studies, however, a decline in degradation efficiency from 78.3 to 52.9% was reported after just 4 cycles when g-C3N4 was co-doped with sulfur and nitrogen (Gasim et al. 2023). This loss in efficiency was due to the high oxidation of the surface of the nitrogen- and sulfur-co-doped g-C3N4. Furthermore, the atoms used in the doping (sulfur and nitrogen) led to lesser active sites as co-doping leads to the increase in graphitization and strongly bonded carbon atoms that inhibit the charge separation of the g-C3N4. Figure 7C shows that the XRD patterns of 2%P-g-C3N4 before and after 5 cycles did not change denoting its stability.

Identification of degradation products and pathways

Figure 8A and B shows the mass spectra before and after the degradation of ciprofloxacin. Figure 8A shows a parent ion m/z 332 which is not present after photodegradation (Fig. 8B). The absence of the parent ion was accompanied by the appearance of new ion peaks m/z 151, 186, 192, 208, 224, 245, 255, 263, 281, 307, 309, 335, 347, 362, and 363 (Fig. 8B). The possible degradation pathways for ciprofloxacin are given in Fig. 10A and B, which include (a) the OH substitution and the defluorination reaction to oxidize the quinoline moiety and (b) the defluorination reaction on the quinoline moiety begins with the initial attack on carbon–carbon double bond by hydroxyl radicals to yield a molecule with m/z (363) and m/z (335). This is then followed by the release of HCOOH and CO group to produce an anthralin acid analog with m/z (307). This anthralin acid can undergo the release of CO to produce the compound m/z (281). The complete breakage of the piperazinyl of ciprofloxacin is also supported by the presence of m/z value 245. Similar intermediate products with m/z values of 362, 291, 263, 181, and 167 were reported in a study by Gasim et al. (2023) which were attributed to the bond breakage of C–N, formaldehyde loss, and defluorination process during photodegradation (Gasim et al. 2023). Chuaicham et al. (2021) found that the photodegradation of ciprofloxacin led to intermediate products at m/z values of 302, 256, 245, 231, 219, 217, 205, and 188 which were attributed to the disorientation of the piperazine ring, defluorination, and the release of –NH and COOH groups (Chuaicham et al. 2021). It can be noted that the degradation pathways of the doped g-C3N4 follow similar pathways for the degradation of ciprofloxacin regardless of what atoms have been used as a dopant for g-C3N4.

Fig. 8
figure 8

LC–MS spectra for 10 ppm ciprofloxacin degradation products A before degradation and B after degradation with 2%P-g-C3N4

Fig. 9
figure 9

LC–MS spectra for 10 ppm sulfamethoxazole degradation products A before degradation and B after degradation with 2%P-g-C3N4

Fig. 10
figure 10

Proposed degradation pathways A and B for 10 ppm ciprofloxacin after degradation with 2%P-g-C3N4

The LC–MS spectra for sulfamethoxazole are depicted in Fig. 9A and B. Figure 9A shows the existence of the parent ion peak of m/z (254) in the untreated aqueous solution, which was not present in the degraded aqueous solution. Figure 9B shows the degradation of the sulfamethoxazole compound into other compounds with m/z 164, 175, 180, 190, 208, 210, 230, 238, 269, 271, 283, 371, 374, 417, and 502 after 180 min using 2% P-g-C3N4. The possible degradation pathways for sulfamethoxazole are given in Fig. 11A, B with (a) being the result of a cleavage reaction that forms when the electrophilic radical attacks the molecule with m/z (284) to form m/z (190) and (b) the formation of a dimer which is proposed to be formed by the coupling of the nitrogen centered radicals derived from NH2. Hasija et al. (2023) reported a similar pathway reported in this research toward the degradation of sulfamethoxazole, i.e., the oxidation of the aromatic amine on the electrophilic sites, hydroxylation, and the cleavage reaction leading to intermediate products with m/z values at 269, 265, and 175. This shows that P-doped g-C3N4 performs comparatively to other dopants toward the degradation of sulfamethoxazole.

Fig. 11
figure 11

Proposed degradation pathways A and B for 10 ppm sulfamethoxazole after degradation with 2%P-g-C3N4

Conclusion

The doping of graphitic carbon nitride with phosphorus to prepare (P-g-C3N4) photocatalysts was achieved by utilizing a simple calcination method. The optimization, morphology, optical properties, and photocatalytic activities of the photocatalysts were studied. The results illustrated that P-doping of g-C3N4 increased the degradation performance of the photocatalyst in degrading ciprofloxacin and sulfamethoxazole as revealed from the higher degradation percentages for P-g-C3N4 (2%, 4%, and 6%) in contrast to the unmodified g-C3N4. The 2%P-g-C3N4 was found to be the optimum doping percentage with the degradation percentages for sulfamethoxazole reaching a high of more than 70%, while for ciprofloxacin it was over 60%. Also, P-g-C3N4 displayed good reusability and stability results with degradation still reaching 65% for sulfamethoxazole after 5 cycles and the structural integrity of the photocatalyst not being altered. Furthermore, LCMS analysis of the degradation for ciprofloxacin and sulfamethoxazole revealed the formation of by-products that resulted from the interaction of the parent ion and photogenerated electrophilic radicals. Due to the ease of synthesis of this photocatalyst and its performance, it can be employed in the treatment of pharmaceutical pollutants effectively and efficiently. The presence of phosphorous improved the visible light absorption capacity of the g-carbon nitride. This is a contribution toward sustainable photocatalytic systems because sunlight energy can be harnessed. Moreover, this work presents a closer step toward the practical application of carbon photocatalysts in the remediation of organic pollutants. Therefore, further investigation will be done to enhance the performance of P-g-C3N4 by incorporating other technologies such as hollow fiber membranes, which have been considered effective supports over flat sheet membranes as their microstructure can be specifically tailored for photocatalysts. The findings of which will be paramount in its potential for inclusion in the remediation of various emerging pollutants and water treatment plants.