The verse
And whoever contradicts and opposes the Messenger (Muhammad) after the right path has been shown clearly to him, and follows other than the believers' way, We shall keep him in the path he has chosen, and burn him in Hell – what an evil destination![Quran 4:115 (Translated by Muhammad Muhsin Khan)]
This verse is interpreted as indicating that before practising takfir, one must first provide guidance to the person in question, explaining that what they are doing is wrong.
The Qur'an emphasises that accusations of unbelief are not to be made lightly:
O you who believe! When you go (to fight) in the Cause of God, verify (the truth), and say not to anyone who greets you (by embracing Islam): "You are not a believer"; seeking the perishable goods of the worldly life. There are much more profits and booties with God. Even as he is now, so were you yourselves before till God conferred on you His Favours (i.e. guided you to Islam), therefore, be cautious in discrimination. God is Ever Well-Acquainted with what you do.[Quran 4:94 (Translated by Muhammad Muhsin Khan)]