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:10:106

And do not invoke besides Allah that which neither benefits you nor harms you, for if you did, then indeed you would be of the wrongdoers.'"  

and do not call upon, ˹do not˺ worship, besides God, that which can neither profit you, should you worship it, nor hurt you, should you not worship it; for if you do, this, hypothetically speaking, then you will surely be of the evildoers.
القرآن:١٠:١٠٦

وَلَا تَدْعُ مِنْ دُونِ اللَّهِ مَا لَا يَنْفَعُكَ وَلَا يَضُرُّكَ ۖ فَإِنْ فَعَلْتَ فَإِنَّكَ إِذًا مِنَ الظَّالِمِينَ  

{ولا تدع} تعبد {من دون الله ما لا ينفعك} إن عبدته {ولا يضرك} إن لم تعبده {فإن فعلت} ذلك فرضا {فإنك إذًا من الظالمين}.