Graphitic carbon nitride nanocomposite doped with La:Y2O3 was used as a new sensor for detection and determination of two hazardous active pharmaceutical compounds, Tacrolimus and Ulipristal acetate, by fluorescence spectrophotometry. This novel nanosensor has a fantastic ability to detect these drugs quickly, accurately, and simultaneously. The effect of Tacrolimus on this nanosensor is the quenching of fluorescence emission intensity at the wavelength of 369 nm while the Ulipristal acetate increases the fluorescence emission at 433 nm. Doehlert design was used to optimize the effective factors to reach the maximum fluorescence emission intensity of the nanosensor. Factors including pH, buffer solution concentration and the ratio of La:Y2O3 dopant in the nanocomposite structure. Under optimal conditions, the limit of detection of 17 nM and the limit of qualification of 58 nM for Tacrolimus and the limit of detection of 11 nM and the limit of qualification of 36 nM for Uipristal acetate were obtained with good accuracy. The prepared g-C3N4@La: Y2O3 nanocomposite has a reasonable ability to photodegrade these two drugs. In this regard, the process of photocatalytic degradation of Tacrolimus and Ulipristal acetate was investigated under visible light irradiation. The effect of active species in photocatalytic degradation was evaluated in order to determine the exact degradation mechanism, and the effect of Fenton factors on analytes degradation was also investigated.