And 0 my people, let not your hostility towards me cause you to suffer what was suffered by the people of Nuh, or the people of Hud, or the people of Salih. And the people of Lut are not far from you.
The sense of the last sentence is that the overturned habitations of the people of Sayyidna Lut (علیہ السلام) were close to Madyan where they were. Then, in terms of time, the punishment that came upon them was very close. From this they could learn their lesson and leave their obstinacy.
The people of Shu‘ayb’s community considered themselves Lords of Midian, taking things which had been given to them for the purpose of putting them to the test as their inalienable right. With all this in mind, they planned aggressive measures against Shu‘ayb. They even threatened to banish him and his companions from their land ( 7:88 ). But in the land which they considered their very own and of which they had become landlords, a terrible earthquake with horrifying tremors erupted at God’s behest; as a result of which, the whole region was destroyed. They were annihilated in their own domain, as if they had never existed. However, those members of the community who had accepted Shu‘ayb’s word, and had become his companions, were saved by special divine intervention.
Uthmani text of the Madinah mushaf (King Fahd Complex). Translation: Saheeh International. Tafsir via Quran.com.