Sequence
In the previous verse (56), it was said that Allah will be the final judge and decision-maker in what they used to differ in between them-selves. This verse describes that decision.
Commentary
Are the sufferings of this world beneficial for the next life?
The words "I shall punish them in this world and in the Hereafter" in verse 56 may create a little doubt. Since the statement here relates to the Judgment to be pronounced on the Last Day, how can the statement -'I shall punish them in this world and in the hereafter`- be explained as this world of ours would not exist at that time and even though it exists today, but the Judgment is to be given on the Day of Resurrection?
This difficulty can be resolved by turning to an analogy. This saying is similar to the saying of a judge to a culprit -'Right now I am sending you to the jail for a year; if you misbehave there, I shall make it for two years'- which simply means that those two years will be counted from the day the punishment is being awarded. Based on this, it is certain that following any misbehaviour the two-year punishment will become effective. So, given the misconduct, the validity of this whole will regulate itself for one more year as 'add-on'.
The same applies here as the punishment in the world has already been given; now the punishment of the Hereafter will be added on and the sum-total will be finally executed on the Last Day, that is, having been punished in the world will not serve as expiation for the punishment of the Hereafter. This is contrary to the condition of believers who, when struck by suffering in the mortal world, have their sins forgiven and find the punishment due in the Hereafter lightened or warded off. For this reason, a hint to this effect has been made in لَا يُحِبُّ الظَّالِمِي and Allah does not like transgressors -v. 57), that is, believers are dear because of their belief and the beloved ones are always treated in such a manner. The disbelievers are detested because of their disbelief and those detested do not receive such treatment. (Bayan a1-Qur'an)