Antibiotics are widely used in treating animal and human diseases; thus, the trace detection of antibiotics is crucial and challenging. Currently, the sensors used for antibiotic detection are generally responsive only to a single type of antibiotic. Herein, we designed and prepared a luminescence ratio nanocomposite (UCN-ATPA-Eu3+), in which the 2-Aminoterephthalic acid (ATPA) was used to functionalize upconversion nanoparticles (UCN), and the Eu3+ ion was coordinated at the periphery. The upconversion/downshifting luminescence detection of antibiotics from different categories can be achieved by using the single nanocomposite and switching the excitation light source (385 and 980 nm), and their corresponding mechanisms of detection were demonstrated and discussed. The upconversion detection was based on the Förster resonance energy transfer and inner filter effect between the detection object and the UCN, while the downshifting detection was attributed to the competition absorbance of excitation light between the object and ATPA, and then, the energy was transferred to the coordinated Eu3+ through the antenna effect. After the immunity and selectivity of the nanocomposite were verified, detection of real samples was carried out, which displayed high accuracy and repeatability.