The Prophet ﷺ said, "Allah has cursed a people who took the graves of their prophets as places of worship."
أخبرنا عمرو بن علي قال حدثنا خالد بن الحارث قال حدثنا شعبة عن قتادة عن سعيد بن المسيب
أن النبي ﷺ قال لعن الله قوما اتخذوا قبور أنبيائهم مساجد
Sourcing, sahih. Ahmad reported it, 6/146, 252, from the hadith of Saeed bin Abu Aruba, with this wording. It is also found in Sunan al-Kubra, hadith 2173. See the following hadith. In the manuscripts it appears as "Shuba," but the correct reading is Saeed, as confirmed in Sunan al-Kubra of Nasai and Tuhfat Ashraf of Mizzi, 11/412.