It probably used to be difficult to imagine how such a situation as depicted could be an example of God's mercy for the people of the cities (rather than some idea of 'vengeance') and the world more generally; but I find now this destruction increasingly easy to understand as an act of mercy.
A society, a civilization, can get itself into such a terrible situation of value-inversion that its public, official, approved and legally-enforced morality becomes the opposite of truth and goodness. And at the same time many of its people are so hollowed-out by Godlessness that, far from resisting evil, they regard evil as something to boast about - and indeed feel great personal self-satisfaction by advertising their own de facto affiliation to powers of darkness.
The spiritual (let alone material) consequences of such a situation will be one of evil feeding upon itself and growing, such that the scale of evil escalates - with new horrors being continually discovered, only to be surpassed.
And there is no escape even in death; since the mass of people will die in despair, fear, resentment, pride or despair - consenting to, or actively desiring, appalling post-mortal situations for their souls (yet regarding these as desirable!).
God's mercy for such a civilization may take the form of a swift and decisive termination of this positive-feedback cycle of evil - swift... but with the end allowing just enough time for a suddenly dawning realization of truth to offer the best possible (although, unfortunately, still remote) chance of repentance.
I think it is important that we can at least understand how this may be so - such that if, or when, such a merciful situation ensues; we can realize what is happening, and act appropriately.