The Command to maintain the Ties of Kinship and the Prohibition of Extravagance
When Allah mentions honoring one's parents, He follows this with the command to treat one's relatives well and to maintain the ties of kinship. According to the Hadith:
«أُمَّكَ وَأَبَاكَ، ثُمَّ أَدْنَاكَ أَدْنَاك»
وفي رواية
«ثُمَّ الْأَقْرَبَ فَالْأَقْرَب»
(Your mother and your father, then your closest relatives and the next closest.) According to another Hadith:
(Whoever would like to see his provision expanded and his life extended, let him maintain his ties of kinship.)
وَلاَ تُبَذِّرْ تَبْذِيرًا
(But spend not wastefully (your wealth) in the manner of a spendthrift.) When Allah commands spending, He forbids extravagance. Spending should be moderate, as stated in another Ayah:
What an unusual moral training is being given here in this verse through the Holy Prophet ﷺ to the entire Muslim community! It is being said to them: If people needing help come to you and you have nothing to give to them, and for that reason you are compelled to turn away from them, even then, this act of turning away or excusing yourself should not be with an air of indifference, or with an attitude that could be insulting for the addressee. In fact, this turning away or seeking of excuse should be coupled with an expression of your inability or constraint.
Regarding the background of the revelation of this verse, a report from Sayyidna Ibn Zaid ؓ says that some people used to ask for financial help from the Holy Prophet ﷺ and he knew what would be given to them would be spent in the spreading of disorder. Therefore, he refused to give it to them, for this refusal was a device to stop them from indulging in disorder. Thereupon, this verse was revealed. (Qurtubi)
In the Musnad of Said ibn Mansur, it has been mentioned on the authority of Sayyidna Saba' ibn Hakam ؓ that the Holy Prophet ﷺ had received some supply of cloth. He distributed it over those deserving. After that came some others when the supply was finished and he had nothing to give. It was about the later that this verse was revealed.
Tazkirul Quran
Maulana Wahiduddin KhanOn ayahs 28–29
A man has a right to spend on himself whatever he earns by his own hard work. However, the Islamic law lays down that he should avoid the habits of a spendthrift; he should spend his wealth on actual necessities and not on vanity or display. Secondly, everyone must realize that others have a right to his earnings—be they relatives, neighbours, travellers or needy persons. If one is to spend one’s wealth according to the will and pleasure of God, one must first of all economize by refraining from pointless spending. Indeed, extravagance is a weapon used by Satan to induce one to neglect one’s duties towards the poor and needy.
Uthmani text of the Madinah mushaf (King Fahd Complex). Translation: Saheeh International. Tafsir via Quran.com.