A large amount of Cr2O72− and glyphosate (GLYP) discharge cause serious water pollution. In this paper, two new MOFs (Zn‐DPIA and Cd‐DPIA) were synthesized, which have excellent selectivity and sensitivity in the detection of Cr2O72− and GLYP. The detection limits (LODs) of Zn‐DPIA sensing Cr2O72− and GLYP were 1.37 and 1.92 μM, respectively, and the LODs of Cd‐DPIA sensing Cr2O72− and GLYP were 1.19 and 1.42 μM, respectively. Cr2O72− and GLYP detection based on Zn‐DPIA and Cd‐DPIA in tap water is highly reliable based on high recovery rates (97% to 106% and 95% to 103%), indicating that Zn‐DPIA and Cd‐DPIA have practical application prospects.