All perfect praise be to Allah, The Lord of the worlds. I testify that there is none worthy of worship except Allah and that Muhammad is His slave and Messenger.
It is clear from the two verses that they are about the past nations, and they include a warning against those who disbelieve in Allah, who associate others in worship with Him, and who oppress His servants.
Ibn Al-Jawzi said in Zaad Al-Maseer, while quoting the statements of the interpreters of the Quran about the verse: {And how many a city have We destroyed that was insolent in its [way of] living,} [Quran 28:58], said:
“Ataa' said: 'They lived in insolence and conceit and ate from the provision of Allah, but they worshiped idols.' Regarding the verse: {and those are their dwellings which have not been inhabited after them except briefly.} Ibn ‘Abbaas said, ‘It was not inhabited except by travelers and passers-by for a day or an hour,’ meaning that it was not dwelt in after them except rarely.' {And it is We Who were the inheritors}, meaning that no successors had replaced them after their destruction in their homes, so their homes remained uninhabited.”
Ibn Katheer said in regard to the interpretation of the second verse:
“{And how many a city did We destroy while it was committing wrong - so it is [now] fallen into ruin - and [how many] an abandoned well and [how many] a lofty palace!} [Quran 22:45] meaning, how many a city did We destroy while it was committing wrongful deeds by rejecting the Messenger sent to it. {So it is [now] fallen into ruin}; Adh-Dhahhaak said, ‘Leveled to their roofs,’ i.e. their houses and cities were destroyed. {And [how many] an abandoned well.} means that no one draws water from it and that no one comes to it after it had been frequented often by crowds of people. {And [how many] a lofty palace!} `Ikrimah said, ‘This refers to palaces whitened with plaster.’”
Allah knows best.