The Quran in a number of places mentions the following:
يَغْفِرُ لِمَنْ يَشَاءُ وَيُعَذِّبُ مَنْ يَشَاءُ
He forgives whom He wills and punishes whom He wills
To mention a few examples we have the following:
You will notice the order in the Quran with Allah SWT mentioning the forgiveness for his creation prior to mentioning his punishment.
In reference to Allah's mercy and wrath we have the following hadeeth collected in Sahih Al-Bukhari and Sahih Muslim
عن أبي هريرة، رضي الله عنه ، قال: قال رسول الله ، صلى الله عليه وسلم لما خلق الله الخلق، كتب في كتاب، فهو عنده فوق العرش: إن رحمتي تغلب غضبي".
Abu Hurairah (May Allah be pleased with him) reported:
The Messenger of Allah (ﷺ) said, "When Allah created the creatures, He wrote in the Book, which is with Him over His Throne: 'Verily, My Mercy prevailed over My Wrath"
So therefore the word order in the ayah reflects the prevalence of his mercy over his wrath and punishment
However, there is one instance in the Quran where punishment is mentioned prior to His mercy.
In Surat Al-Maida we read:
يُعَذِّبُ مَنْ يَشَاءُ وَ يَغْفِرُ لِمَنْ يَشَاءُ
He punishes whom He wills and forgives whom He wills
To understand why this is the case we need to look at the context. If we read the Ayaat prior We can understand why this is the case.
We have the story of the Murder of Habeel who was killed by his brother and the revelation given to the Children of Israel regarding taking of another soul and saving a soul.
The consequences of taking a soul is mentioned first and this is in line with mentioning punishment first in Ayah 40
Allah SWT then mentions the severe punishment of those who wage war against Allah SWT and His Messenger and sow corruption on the earth.
and finally the punishment of the thief is mentioned
In this context, punishment being mentioned prior to forgiveness was more appropriately sound . Appropriate sentence positioning is just one of the numerous considerations that one needs to take into account when authoring speech. Take into account that the Quran was speech that was spoken by the Prophet SAW over a 23 year period with no editorial process then one can begin to appreciate the Quran's divine nature and its superiority over all other speech.