Finding and developing effective targeted drug delivery systems has emerged as an attractive approach for treating a wide range of diseases. In the present study, the potential of alkaline earth metal functionalized porphyrin-like porous C24N24 fullerenes for delivering 5-fluorouracil (5FU) anticancer drug is assessed using density functional theory calculations. The goal is to evaluate how the addition of alkaline earth metals to C24N24 enhances the adsorption capabilities of this system towards 5FU drug. The adsorption energies and charge transfers are determined in order to evaluate the strength of the interaction between the 5FU and fullerene surfaces. According to the results, adding alkaline earth metals increases the drug’s adsorption energy on the C24N24 fullerene. In all cases, the drug molecule interacts with the metal atom through its C––O group. Furthermore, the adsorption strength of the 5FU increases with metal atom size (Ca > Mg > Be), which is connected to the polarizability of these atoms. The adsorption energies of 5FU are shown to be highly sensitive on solvent effects and the acidity of the environment. The adsorption strength of 5FU decreases within the solvent (water), allowing it to be released more easily. The moderate adsorption energies and short desorption times of 5FU imply that it is reversibly adsorbed on the functionalized fullerenes.