Reducing the side effects of cancer treatment methods is an important issue. The loading efficiency and sustained release of 5-Fluorouracil (5-FU) have been significantly improved by creating a new method. A nanocarrier with pH sensitivity has been developed through the w/o/w emulsification method. It is loaded with 5-FU and comprises of chitosan (CS), hydroxyapatite (HAp), and graphitic carbon nitride (g-C3N4). g-C3N4 nanosheets were incorporated in CS/HAp hydrogel to improve the entrapment and loading efficiency. Drug loading efficiency and entrapment efficiency reached 48 % and 87 %, respectively, and the FTIR and XRD tests verified evidence of the formation of chemical bonds among the drug and nanocarrier. Structural analysis was done using FE-SEM. DLS and zeta potential were employed to obtain average size distribution and surface charge. The release profile of 5-FU in various conditions shows the nanoparticles' pH dependence, and the nanocomposite's controlled release is consistent with the Korsmeyer-Peppas kinetic model. Cell apoptosis and cytotoxicity were evaluated in vitro using flow cytometry and MTT analysis. The biocompatibility of CS/HAp/g-C3N4 against MCF-7 cells was shown by the MTT method and confirmed by flow cytometry. CS/HAp/g-C3N4@5-FU led to the highest apoptosis rate in MCF-7 cells, indicating the nanocarrier's efficiency in killing cancer cells. These data indicate that the designed CS/HAp/g-C3N4@5-FU can be a potential drug for treating cancer cells.