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:47:1In the name of Allah, the Entirely Merciful, the Especially Merciful.

Those who disbelieve and avert ˹people˺ from the way of Allah - He will waste their deeds.  

Those who disbelieve, from among the people of Mecca, and bar, others, from the way of God, that is to say, ˹from˺ faith, He will leave their works to waste, such as giving food ˹to the poor˺ or being kind to kin, and so they will find no reward for these ˹works of theirs˺ in the Hereafter; ˹but˺ they are requited for them in this world ˹purely˺ out of His bounty, exalted be He.
القرآن:٤٧:١بِسْمِ اللَّهِ الرَّحْمَٰنِ الرَّحِيمِ

الَّذِينَ كَفَرُوا وَصَدُّوا عَنْ سَبِيلِ اللَّهِ أَضَلَّ أَعْمَالَهُمْ  

{الذين كفروا} من أهل مكة {وصدُّوا} غيرهم {عن سبيل الله} أي الإيمان {أضل} أحبط {أعمالهم} كإطعام الطعام وصلة الأرحام، فلا يرون لها في الآخرة ثوابا ويجزون بها في الدنيا من فضله تعالى.

See similar narrations below:

Collected by Qurʾān

Indeed, those who disbelieve and avert ˹people˺ from the way of Allah have certainly gone far astray.  

Surely those who disbelieve, in God, and bar, people, from the way of God, ˹from˺ the religion of Islam, by concealing the descriptions of Muhammad (s), and these are the Jews, they have indeed gone far astray, from the truth.

إِنَّ الَّذِينَ كَفَرُوا وَصَدُّوا عَنْ سَبِيلِ اللَّهِ قَدْ ضَلُّوا ضَلَالًا بَعِيدًا  

{إن الذين كفروا} بالله {وصدوا} الناس {عن سبيل الله} دين الإسلام بكتمهم نعت محمد ﷺ وهم اليهود {قد ضلوا ضلالا بعيدا} عن الحق.