The Messenger of Allah ﷺ recited this verse, "He is the One who has revealed to you the Book. Out of it there are verses that are definite in meaning... up to the men of understanding" [Al Imran 3:7].She said, the Messenger of Allah ﷺ then said, "When you see those who follow what is ambiguous in it, those are the ones whom Allah has named, so beware of them."
حدثنا القعنبي حدثنا يزيد بن إبراهيم التستري عن عبد الله بن أبي مليكة عن القاسم بن محمد
قرأ رسول الله ﷺ هذه الآية {هو الذي أنزل عليك الكتاب منه آيات محكمات إلى أولو الألباب} قالت فقال رسول الله ﷺ فإذا رأيتم الذين يتبعون ما تشابه منه فأولئك الذين سمى الله فاحذروهم
Bukhari related it in the Tafsir, the tafsir of Surah Al Imran, the chapter titled "Some of it are clear verses," etc., hadith 2665, from Qanabi, hadith 4547, and Muslim related it in the Book of Knowledge, the chapter on the prohibition of following the ambiguous verses of the Quran, through the same chain.