In the Holy Quran it is stated: وَمَا آتَاكُمُ الرَّسُولُ فَخُذُوهُ وَمَا نَهَاكُمْ عَنْهُ فَانْتَهُوا
Reference: Surah Al-Hashr:7
Translation: Whatever the Messenger gives you, take it, and whatever he forbids you, abstain from it. It is said that this verse invites to follow the Prophetic Hadith ﷺ, but this is not the case, because this verse is actually about the distribution of spoils of war, as is evident from the beginning part of the verse.
Allah Almighty says: مَا أَفَاءَ اللَّهُ عَلَى رَسُولِهِ مِنْ أَهْلِ الْقُرَى فَلِلَّهِ وَلِلرَّسُولِ وَلِذِي الْقُرْبَى وَالْيَتَامَى وَالْمَسَاكِينِ وَابْنِ السَّبِيلِ كَيْ لَا يَكُونَ دُولَةً بَيْنَ الْأَغْنِيَاءِ مِنْكُمْ وَمَا آتَاكُمُ الرَّسُولُ فَخُذُوهُ وَمَا نَهَاكُمْ عَنْهُ فَانْتَهُوا وَاتَّقُوا اللَّهَ إِنَّ اللَّهَ شَدِيدُ الْعِقَابِ
Reference: Surah Al-Hashr:7
Translation: Whatever Allah has restored to His Messenger from the people of the towns - it is for Allah and for the Messenger and for the near relatives and the orphans and the needy and the traveler - so that it will not be a thing taken by those among you who are rich. And whatever the Messenger gives you, take it, and whatever he forbids you, abstain from it. And fear Allah; indeed, Allah is severe in penalty.
First Point
When we reflect on the words of the verse, we clearly understand that in the Arabic language, both the words "أعطی" and "آتى" are used for giving, but the word "آتى" has a broader meaning than "أعطی". It also includes giving knowledge, kingship, wisdom, etc., as can be understood from these verses.
Allah Almighty says:
يَرْفَعِ اللَّهُ الَّذِينَ آمَنُوا مِنْكُمْ وَالَّذِينَ أُوتُوا الْعِلْمَ دَرَجَاتٍ وَاللَّهُ بِمَا تَعْمَلُونَ خَبِيرٌ
Reference: Surah Al-Mujadila:11
Translation: Allah will raise those who have believed among you and those who were given knowledge, in degrees. And Allah is Acquainted with what you do.
وَآتَاهُ اللَّهُ الْمُلْكَ وَالْحِكْمَةَ
Reference: Surah Al-Baqarah:251
Translation: And Allah gave him kingship and wisdom.
So in this verse, the sayings of the Prophet ﷺ (hadiths in which your commands are given) are meant because in contrast to "آتى" the word "نھیٰ" meaning prohibition is used, whereas if it meant giving wealth, then "لم یؤتِ" meaning "did not give" could also have been used, as in Allah Almighty's command:
وَآتَاكُمْ مَا لَمْ يُؤْتِ أَحَدًا مِنَ الْعَالَمِينَ
Reference: Surah Al-Ma'idah:20
Translation: He gave what He did not give to anyone in the worlds.
Second point
If the mentioned verse is taken to mean the distribution of wealth, then that is already present in the verse itself. So what is the meaning of the Prophet giving or withholding? Consider the verse:
Allah Almighty says:
مَا أَفَاءَ اللَّهُ عَلَى رَسُولِهِ مِنْ أَهْلِ الْقُرَى فَلِلَّهِ وَلِلرَّسُولِ وَلِذِي الْقُرْبَى وَالْيَتَامَى وَالْمَسَاكِينِ وَابْنِ السَّبِيلِ كَيْ لَا يَكُونَ دُولَةً بَيْنَ الْأَغْنِيَاءِ مِنْكُمْ وَمَا آتَاكُمُ الرَّسُولُ فَخُذُوهُ وَمَا نَهَاكُمْ عَنْهُ فَانْتَهُوا وَاتَّقُوا اللَّهَ إِنَّ اللَّهَ شَدِيدُ الْعِقَابِ
Reference: Surah Al-Hashr:7
Translation: Whatever Allah has returned to His Messenger from the people of the towns, it is for Allah and the Messenger and for the relatives and orphans and the needy and the traveler, so that it may not circulate only among the wealthy among you. And whatever the Messenger gives you, take it, and whatever he forbids you, abstain from it. And fear Allah; indeed, Allah is severe in penalty.
Rather, this emphasizes that the words of the Messenger of Allah ﷺ are your commands and authority; otherwise, what meaning would there be in giving or withholding something that has already been distributed? Just as your giving and withholding is authoritative, so too is your commanding and forbidding, which are your hadiths, authoritative.
Third point
From this noble verse, the Companions of the Prophet, may Allah be pleased with them all, also understood it to mean the Prophetic Hadith, as is found in the most authentic book of Hadith, Sahih Bukhari:
Hazrat Abdullah bin Masood (RA) narrated that Allah Almighty has cursed those who pluck hair and those who cause others to pluck hair, and those who widen the front teeth for beauty, for they alter the creation of Allah. This statement of Abdullah bin Masood (RA) became known to a woman from the tribe of Bani Asad, who was known as Umm Yaqub. She came and said, "I have heard that you have cursed such women?" Abdullah bin Masood (RA) said, "Why should I not curse those whom the Messenger of Allah ﷺ has cursed and who are accursed according to the command of the Book of Allah?" The woman said, "I have also read the Holy Quran, but I have not seen this mentioned anywhere in it." He said, "If you had read it carefully, you would have certainly found it. Have you not read this verse: (وما آتاكم الرسول فخذوه وما نهاكم عنه فانتهوا) 'Obey Allah and His Messenger, and do not dispute and thus lose courage and your strength would depart'?" She said, "I have read it." Abdullah bin Masood (RA) said, "Then the Prophet ﷺ forbade these things."
Reference: (Sahih Bukhari:4886)
After hearing the argument of Sayyiduna Abdullah bin Mas'ud رضي الله عنه, this woman did not say that this ruling pertains only to the distribution of wealth, rather she acknowledged and confirmed the understanding of the Companions رضي الله عنهم.
In another hadith, Hazrat Saeed bin Jareer narrates that he heard from Hazrat Abdullah bin Umar رضي الله عنه and Hazrat Abdullah bin Abbas رضي الله عنه, both of whom testified about the Messenger of Allah ﷺ that he forbade the use of pumpkin vessels, oil pots, vessels made from date palm roots, and vessels coated with tar. Then the Messenger of Allah صلی اللہ علیہ وسلم recited this verse: "O Messenger, accept what is given to you and desist from what they forbid you."
Reference: Sunan an-Nasa'i (5643), Musnad Ahmad (3300)
Similarly, a large group of great Tabi‘in and scholars cite this verse to clarify the reverence and status of the Prophetic hadith. Due to length, we are only providing references:
Reference: Jama' al-'Ilm lil-Shafi'i – al-Umm (7/288), Al-Ibanah al-Kubra by Ibn Battah al-Kubra (1/249), (7/58), Ta'wil Mukhtalif al-Hadith (p.282), Ma'rifat al-Sunan wal-Athar by al-Bayhaqi (1/101), Jami' Bayan al-'Ilm wa Fadlih by Ibn Abd al-Barr (2/1003), (2/1181)
Similarly, the respected mufassirun (exegetes) have also taken this verse as a ruling for following the Sunnah. See:
Reference: Tafsir al-Zamakhshari (4/503), Tafsir Ibn Juzayy (2/360), Tafsir al-Mawardi (5/504), Tafsir al-Qurtubi (18/17)
Final Point
Allah Almighty has established a general rule and a universal principle: ﴿ وَمَا آتَاكُمُ الرَّسُولُ فَخُذُوهُ وَمَا نَهَاكُمْ عَنْهُ فَانْتَهُوا ﴾ "Whatever the Messenger gives you, take it, and whatever he forbids you, abstain from it." This noble verse encompasses the principles and branches of the religion, both apparent and hidden. Moreover, this verse indicates that it is obligatory upon the servants to adhere to and follow whatever the Messenger of Allah ﷺ has brought, and it is not permissible to oppose it. Also, from this verse it is established that the command of the Messenger ﷺ regarding anything is like the command of Allah Almighty, and there is no permission or excuse for anyone to abandon it, nor is it permissible to give precedence to anyone's statement over the statement of the Messenger ﷺ.