The Messenger of Allah ﷺ said, "Allah has cursed those who took the graves of their prophets as places of worship."
حدثنا معاوية بن عمرو قال أبو إسحاق الفزاري قال الأوزاعي عن الزهري عن ابن المسيب
قال رسول الله ﷺ لعن الذين اتخذوا قبور أنبيائهم مساجد
Its isnad is sahih. It is an abridgment of 7352, and see 7818.