From my personal reflection, I have categorised three ways the Qur’anic warnings and punishments against previous and future nations/peoples and their deeds can be taken:
1) The evil deed or sin applies directly to oneself (e.g. temptation of the opposite gender, backbiting, slander, etc.)
2) The evil deed or sin applies indirectly to oneself (e.g. shirk perhaps not in the form of worshipping idols but ostentation)
3) The evil deed or sin applies to someone other than oneself but serves as a reminder or lesson or as a form of contentment for the punishment/establishing of justice against the one who commits it (e.g. mass oppression, murder of innocents, blatant hypocrisy, etc.).
And Allah ﷻ knows best.
