Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
quran:8:52

˹Theirs is˺ like the custom of the people of Pharaoh and of those before them. They disbelieved in the signs of Allah, so Allah seized them for their sins. Indeed, Allah is Powerful and severe in penalty.  

The way of these people is, like the way of Pharaoh’s folk and those before them: they disbelieved in God’s signs and so God seized them, with chastisement, because of their sins (the sentence beginning with kafarū, ‘they disbelieved’, explains the previous one). Truly, God is strong, in what He wills, severe in retribution.
القرآن:٨:٥٢

كَدَأْبِ آلِ فِرْعَوْنَ ۙ وَالَّذِينَ مِنْ قَبْلِهِمْ ۚ كَفَرُوا بِآيَاتِ اللَّهِ فَأَخَذَهُمُ اللَّهُ بِذُنُوبِهِمْ ۗ إِنَّ اللَّهَ قَوِيٌّ شَدِيدُ الْعِقَابِ  

دأبُ هؤلاء {كدأب} كعادة {آل فرعون والذين من قبلهم كفروا بآيات الله فأخذهم الله} بالعقاب {بذنوبهم} جملة كفروا وما بعدها مفسِّرة لما قبلها {إن الله قويٌ} على ما يريده {شديد العقاب}.

See similar narrations below:

Collected by Qurʾān
quran:3:11

˹Theirs is˺ like the custom of the people of Pharaoh and those before them. They denied Our signs, so Allah seized them for their sins. And Allah is severe in penalty.  

Their way is, as the way, as the habit, of Pharaoh’s folk, and the, communities of people before them, such as ‘Ād and Thamūd, who denied Our signs; God seized them, He destroyed them, for their sins (this statement explains the previous one); God is severe in retribution.
القرآن:٣:١١

كَدَأْبِ آلِ فِرْعَوْنَ وَالَّذِينَ مِنْ قَبْلِهِمْ ۚ كَذَّبُوا بِآيَاتِنَا فَأَخَذَهُمُ اللَّهُ بِذُنُوبِهِمْ ۗ وَاللَّهُ شَدِيدُ الْعِقَابِ  

دأبُهم {كدأب} كعادة {آل فرعون والذين من قبلهم} من الأمم كعاد وثمود {كذبوا بآياتنا فأخذهم الله} أهلكم {بذنوبهم} والجملة مفسرة لما قبلها {والله شديد العقاب} ونزل لما أمر النبي ﷺ اليهودَ بالإسلام بعد مرجعه من بدر فقالوا لا يغرنك أن قتلت نفراً من قريش أغمارا لا يعرفون القتال.