I heard Numan bin Bashir, and I will not hear anyone say it after him, say that he heard the Messenger of Allah ﷺ say, "The lawful is clear and the unlawful is clear, and between them are matters that are doubtful," and sometimes he would say "matters of doubt." "I will give you a parable about this. Allah has a sanctuary, and Allah's sanctuary is what He has forbidden. Whoever grazes around the sanctuary is likely to stray into it, and whoever mingles with doubtful matters is likely to grow bold enough to commit them."
حدثنا أحمد بن يونس قال حدثنا أبو شهاب حدثنا ابن عون
سمعت النعمان بن بشير ولا أسمع أحدا بعده يقول سمعت رسول الله ﷺ يقول إن الحلال بين وإن الحرام بين وبينهما أمور مشتبهات وأحيانا يقول مشتبهة وسأضرب لكم في ذلك مثلا إن الله حمى حمى وإن حمى الله ما حرم وإنه من يرعى حول الحمى يوشك أن يخالطه وإنه من يخالط الريبة يوشك أن يجسر
Bukhari narrated it in Buyu, chapter "The lawful is clear and the unlawful is clear, and between them are doubtful matters," hadith 2051, from the hadith of Ibn Awn, and Muslim narrated it in Musaqat, chapter "Taking the lawful and avoiding doubtful matters," hadith 1599, from the hadith of Shaybi, through the same chain.