The Messenger of Allah ﷺ said, "Whenever a Muslim man declares another Muslim man to be a disbeliever, if the accused is indeed a disbeliever, then so be it. Otherwise, the accuser himself becomes the disbeliever."
حدثنا عثمان بن أبي شيبة حدثنا جرير عن فضيل بن غزوان عن نافع
قال رسول الله ﷺ أيما رجل مسلم أكفر رجلا مسلما فإن كان كافرا وإلا كان هو الكافر
Its chain of transmission is sahih. Ahmad narrated it in 2/23 from the hadith of Fudayl bin Ghazwan, with this wording. Muslim also narrated it in hadith 60 from the hadith of Nafi, with this wording.Jareer is Ibn Abdul-Hameed Dabbi.