Allah tells us that in His justice and generosity, on the Day of Judgement He will not judge those who believed in His signs and followed His Messengers, in the same way as He will judge those who rebelled, disobeyed Him and rejected the Messengers sent by Allah to them. This is like the Ayat:
(Or do those who earn evil deeds think that We shall hold them equal with those who believe and do righteous good deeds, in their present life and after their death Worst is the judgement that they make.) (45:21),
(And We will certainly make them taste the nearer punishment before the greater punishment, so that they may return),
the word: أَدْنَىٰ (adna) has been used in the sense of 'nearer' and الْعَذَابِ الْأَدْنَىٰ (al adhab-ul-adna) denotes diseases, sufferings and calamities of the world that are made to befall a lot of people by Allah Ta'ala in order to warn them against their sins. The purpose is to chasten and alert them enough so that they leave off their sins and thus earn their deliverance from the Great Punishment of the Hereafter.
Hence, this verse seems to tell us that all these sufferings, accidents, diseases and pains that inflict sinners in the world are nothing but a sort of mercy for them in as much as they help them get out of their heedlessness and save themselves from the punishment of the 'Akhirah. However, for people who take no lesson even from such unwelcome happenings and fail to turn to Allah, for them, this punishment becomes twofold - first, the cash punishment right here in this world and then, the other being the Great Punishment of the Hereafter. As for the hardships of many kinds that come upon prophets and men of Allah, that is a separate matter. These hardships are a trial for them and trials are the source through which their ranks are raised. At is the hallmark of this trial? How do you recognize the quality of their response? If one were to observe such people even under the stress of calamities and hardships, it will be noticed that they have a kind of peace and tranquility emanating from their trust in Allah Ta’ ala. And it is Allah who knows best.
Tazkirul Quran
Maulana Wahiduddin KhanOn ayahs 17–21
For an individual to avail of guidance, his willingness to accept the Truth is the most important factor. Only those who, by temperament, are ready to accept the Truth whenever it presents itself before them—whether it be revealed through a person of lesser importance, whether such acceptance be a tacit admission of one’s own error, or whether such acceptance leads to upsetting the existing system of one’s life—are capable of availing of guidance. Only those who have such a capacity will find the Truth. Those who want to accept the Truth, but at the same time want their ‘greatness’ to remain intact, will never find it. A man who sacrifices his greatness for the sake of Truth actually finds the greatest thing, namely, the greatness of God. God enters his life in such a way that he sleeps thinking about Him and wakes up with memories of God. His hopes and fears are all linked with God. He surrenders all his possessions to God to the point of not keeping back anything for himself. Such people will forever relish the bounties of the eternal Gardens of Paradise.
Uthmani text of the Madinah mushaf (King Fahd Complex). Translation: Saheeh International. Tafsir via Quran.com.