In this study, we report a core-shell fluorescent nanoprobe consisting of upconversion nanoparticles (UCNPs) NaGdF4 : Yb3+, Er3+ and metal-organic frameworks (MOFs) ZIF-8. ZIF-8 can specifically bind to ferric ions (Fe3+) to change the ultraviolet-visible absorption spectrum of the probe, as a result the fluorescence of the probe was quenched and achieve the detection of Fe3+. At the same time, since rhodamine B (RhB) can quench the fluorescence of this probe, by introducing ferrous ions (Fe2+) and hydrogen peroxide, based on Fenton reaction, the fluorescence signal of this probe can be recovered after the degradation of RhB, so it also can be used to detect Fe2+. Importantly, as the first report of UCNP@MOF probes for detecting Fe3+ and Fe2+, respectively, this method exhibits a good selectivity and anti-interference capability. Finally, it was used to detect Fe3+ and Fe2+ in the serum with excellent recoveries.