Being preoccupied with worldly gains over worshipping Allaah

Question
People become preoccupied with many things, and they forget that they were created for the sake of worshipping Allaah, the Most Exalted. They seek to increase their wealth and boast about what makes the poor look at them with envy and yearning. My question is, Is there a cure which will protect the poor from yearning, and protect the one whom Allaah has bestowed with wealth fro, such mentioned actions?
Answer

Allaah has warned against becoming preoccupied with worldly affairs and forgetting the purpose for which Allaah created them, namely to worship Him.

(أَلۡهَىٰكُمُ ٱلتَّكَاثُرُ)
Competition in worldly increase diverts you…” (AT-Takathur 1)

This means, you have been occupied with seeking to increase your wealth and you have become distracted from the real purpose of your creation.

(حَتَّىٰ زُرۡتُمُ ٱلۡمَقَابِرَ)
.. until you visit the graveyards.” (2)

This is because the grave will remind you of death, and when a person remembers death, they will approach their Lord and reduce their exhaustion in the pursuit of worldly gains. This is why we have been commanded to increase our remembrance of death, because it destroys vain desires. There is no doubt that being preoccupied with worldly gains distracts a person from the worship of Allaah, Most Exalted, since the world is like the competitor for the Hereafter. An intelligent person would occupy himself with the purpose for which he was created, and at the same time, he does not forget to search for that which he needs to sustain himself to fulfill his goal. This is why Allaah alerts the person,

(وَلَا تَنسَ نَصِيبَكَ مِنَ ٱلدُّنۡيَا)
… and yet, do not forget your share of the world…” (Al-Qassass 77)

meaning, the sustenance you need in order to fulfil the object of your creation. Regarding the poor person who looks in anticipation at the rich person and how the latter enjoys the worldly pleasures while the former cannot, there can be no doubt that such a person will feel heartbroken and saddened. The cure to this feeling is the saying of the Prophet Muhammad ﷺ,

When a person looks at someone upon whom Allaah has bestowed wealth and beauty, then let him also look at someone who has less than him.” (Bukhaary 6490)

Hence, we have been ordered to look at those people who have been given even less to what you have been given, then you will appreciate the great blessings Allaah has given you. It is mentioned in the hadeeth,

It is most appropriate to make a person not belittle the blessings of Allaah upon him.” (Tirmithy 1780)

However, when a person is looking at matters pertaining to the religion, he is not permitted to look at someone less than him. Rather, a person should look at the one higher than him so that he may aspire to do more to get closer to Allaah, Most Exalted, through their actions.