Narrated Ibn 'Umar: Allah's Messenger ﷺ said, "Do not enter the ruined dwellings of those who were unjust to themselves unless (you enter) weeping, lest you should suffer the same punishment as was inflicted upon them".
It also reminds us that Allah knows all our actions and will punish us accordingly if we do something wrong or unjustly hurt others. Therefore, it is important for us to always be mindful of our actions and strive towards doing good deeds in order to avoid any form of punishment from Allah in this world or hereafter.