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:176

And do not be grieved, ˹O Muhammad˺, by those who hasten into disbelief. Indeed, they will never harm Allah at all. Allah intends that He should give them no share in the Hereafter, and for them is a great punishment.  

Let them not grieve you (read yuhzinka, or yahzunka from ˹1st form˺ hazanahu, ‘he made him grieve’, an alternative expression to ˹4th form˺ ahzanahu, ‘he made him grieve’) those that vie with one another in unbelief, succumbing to it promptly by supporting it, namely, the Meccans or the hypocrites: in other words, do not be concerned for their unbelief; they will not hurt God at all, by their actions, only hurting themselves. God desires not to assign them any portion, any lot, in the Hereafter, that is, in Paradise, and that is why God forsook them; and theirs is a mighty chastisement, in the Fire.
القرآن:٣:١٧٦

وَلَا يَحْزُنْكَ الَّذِينَ يُسَارِعُونَ فِي الْكُفْرِ ۚ إِنَّهُمْ لَنْ يَضُرُّوا اللَّهَ شَيْئًا ۗ يُرِيدُ اللَّهُ أَلَّا يَجْعَلَ لَهُمْ حَظًّا فِي الْآخِرَةِ ۖ وَلَهُمْ عَذَابٌ عَظِيمٌ  

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