Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
quran:3:118

O you who have believed, do not take as intimates those other than yourselves, for they will not spare you ˹any˺ ruin. They wish you would have hardship. Hatred has already appeared from their mouths, and what their breasts conceal is greater. We have certainly made clear to you the signs, if you will use reason.  

O you who believe, do not take as intimates, as sincere friends, revealing to them your secret thoughts, anyone apart from yourselves, from among the Jews, Christians and the hypocrites; such men spare nothing to ruin you (khabālan is in the accusative because the preposition ˹that usually precedes it, sc. fī’l-khabāl˺ has been omitted), that is to say, they would not be remiss about corrupting you; they would love, they wish, for you to suffer (˹al-‘anat means˺ extreme hardship). Hatred, enmity towards you, is revealed, it is manifested, by their mouths, by sowing discord among you and informing the idolaters of your secret ˹plans˺; and what their breasts conceal, of enmity, is yet greater. Now We have made clear to you the signs, of their enmity; if you understand, this, then do not befriend them.
القرآن:٣:١١٨

يَا أَيُّهَا الَّذِينَ آمَنُوا لَا تَتَّخِذُوا بِطَانَةً مِنْ دُونِكُمْ لَا يَأْلُونَكُمْ خَبَالًا وَدُّوا مَا عَنِتُّمْ قَدْ بَدَتِ الْبَغْضَاءُ مِنْ أَفْوَاهِهِمْ وَمَا تُخْفِي صُدُورُهُمْ أَكْبَرُ ۚ قَدْ بَيَّنَّا لَكُمُ الْآيَاتِ ۖ إِنْ كُنْتُمْ تَعْقِلُونَ  

{يا أيها الذين آمنوا لا تتخذوا بطانة} أصفياء تطلعونهم على سرِّكم {من دونكم} أي غيركم من اليهود والنصارى والمنافقين {لا يألونكم خبالا} نصب بنزع الخافض أي لا يقصرون لكم في الفساد {ودُّوا} تمنَّوا {ما عنتم} أي عنتكم وهو شدة الضرر {قد بدت} ظهرت {البغضاء} العداوة لكم {من أفواههم} بالوقيعة فيكم وإطلاع المشركين على سركم {وما تخفي صدورهم} من العداوة {أكبر قد بينا لكم الآيات} على عدواتهم {إن كنتم تعقلون} ذلك فلا توالوهم.

See similar narrations below:

Collected by Ṭabarānī
tabarani:8047Isḥāq b. Dāwud al-Ṣawwāf al-Tustarī > al-Mundhir b. al-Walīd al-a neighborūdī > Ḥumayd b. Mihrān > Abū Ghālib > Abū Umāmah

[Machine] About the Prophet ﷺ regarding the saying of Allah (O you who have believed, do not take as intimates those other than yourselves, as they will not spare you [any] ruin. They wish you would have hardship. Hatred has already appeared from their mouths, and what their breasts conceal is greater. We have certainly made clear to you the signs, if you will use reason.) He ﷺ said, "They are the Khawarij."  

الطبراني:٨٠٤٧حَدَّثَنَا إِسْحَاقُ بْنُ دَاوُدَ الصَّوَّافُ التُّسْتَرِيُّ ثنا الْمُنْذِرُ بْنُ الْوَلِيدِ الْجَارُودِيُّ حَدَّثَنِي ثنا حُمَيْدُ بْنُ مِهْرَانَ عَنْ أَبِي غَالِبٍ عَنْ أَبِي أُمَامَةَ

عَنِ النَّبِيِّ ﷺ فِي قَوْلِ اللهُ ﷻ {يَا أَيُّهَا الَّذِينَ آمِنُوا لَا تَتَّخِذُوا بِطَانَةً مِنْ دُونِكُمْ لَا يَأْلُونَكُمْ خَبَالًا وَدُّوا مَا عَنِتُّمْ قَدْ بَدَتِ الْبَغْضَاءُ مِنْ أَفْوَاهِهِمْ وَمَا تُخْفِي صُدُورُهُمْ أَكْبَرُ قَدْ بَيَّنَّا لَكُمُ الْآيَاتِ إِنْ كُنْتُمْ تَعْقِلُونَ} قَالَ «هُمُ الْخَوَارِجُ»