Praise be to Allah, the Lord of the Worlds; and may His blessings and peace be upon our Prophet Muhammad and upon all his Family and Companions.
The Hardship, harm and difficulties that befall a person are either to rise his status, or to punish him for some sins or disobediences. They also could be just expiation for those sins and disobediences; all the above are close to each other or inter-related.
There is no benefit for a person to distinguish between a punishment and a trial. In both cases, the person is required to be patient. If it is a punishment, then it is expiation for his sins. The Prophet (Sallallahu Alaihi wa Sallam) said: "If Allah wants good for a person, then He will hasten the punishment for him in this world, and if He wants bad for him, He will reserve the punishment for him until The Day of Judgment." (Reported by Imam Ahmed and Al-Thirmidhi.)
Moreover, if the hardship is a trial then it surely increases one's status. The Prophet (Sallallahu Alaihi wa Sallam) said: "If Allah loves a nation, He afflicts it. Now, those who are satisfied get satisfaction, while those who are dissatisfied get displeasure." (Reported by Al-Thirmidhi and others.)
However, if a hardship befalls a person after he has committed a sin, then this is an evidence that it is a punishment. A human being commits many mistakes. Someone should not see himself as being clean from sins and then wonders about the hardship claiming that it is not as a result of sin.
The same thing applies to a person who gets blessed with bounties, he should thank Allah for the bounties with his heart, tongue and limbs. He has also to fear that this pushes him to committing sins, so one should never feel secure from the Punishment of Allah, as Allah says: "Did they then feel secure against the Plan of Allâh. None feels secure from the Plan of Allâh except the people who are the losers". (Al-A'raf 7:99)
Nevertheless, there is no contradiction between being grateful and enjoying the blessing, and being fearful and seeking forgiveness, but one should join these two matters.
However, it is preponderant that the blessings become an inducement for the person to commit more sins if the person is already extravagant in committing sins and acts of disobedience. The Prophet (Sallallahu Alaihi wa Sallam) said: "If you notice that Allah is providing the goods of this world to a person despite the fact that he is sinful, then this is inciting him to commit sins until Allah takes the person (upon his committing sins). Then the Prophet (Sallallahu Alaihi wa Sallam) recited: " So, when they forgot (the warning) with which they had been reminded, We opened to them the gates of every (pleasant) thing, until in the midst of their enjoyment in that which they were given, all of a sudden, We took them to punishment, and lo! They were plunged into destruction with deep regrets and sorrows."(Al-An'am 6:44)." (Reported by Ahmed and Al-Tabrani, and Al-Albani graded it as authentic.)
Allah knows best.