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:21:41

And already were messengers ridiculed before you, but those who mocked them were enveloped by what they used to ridicule.  

And verily messengers before you were derided — herein is a statement to comfort the Prophet (s) — but those who mocked them were encircled by, it was sent down ˹against them˺, that which they used to deride, namely, chastisement — likewise it shall befall those who have derided you.
القرآن:٢١:٤١

وَلَقَدِ اسْتُهْزِئَ بِرُسُلٍ مِنْ قَبْلِكَ فَحَاقَ بِالَّذِينَ سَخِرُوا مِنْهُمْ مَا كَانُوا بِهِ يَسْتَهْزِئُونَ  

{ولقد استهزئ برسل من قبلك} فيه تسلية للنبي ﷺ {فحاق} نزل {بالذين سخروا منهم ما كانوا به يستهزءون} وهو العذاب فكذا يحيق بمن استهزأ بك.

See similar narrations below:

Collected by Qurʾān
quran:6:10

And already were messengers ridiculed before you, but those who mocked them were enveloped by that which they used to ridicule.  

And messengers were indeed mocked before you — this is meant as a consolation for the Prophet, (s) — but those who scoffed at them were encompassed by that which they mocked, namely, ˹by the˺ punishment ˹sent down on them˺: those who mock you will be encompassed likewise.
القرآن:٦:١٠

وَلَقَدِ اسْتُهْزِئَ بِرُسُلٍ مِنْ قَبْلِكَ فَحَاقَ بِالَّذِينَ سَخِرُوا مِنْهُمْ مَا كَانُوا بِهِ يَسْتَهْزِئُونَ  

{ولقد استُهزئ برسل من قبلك} فيه تسلية للنبي ﷺ {فحاق} نزل {بالذين سخروا منهم ما كانوا به يستهزئون} وهو العذاب فكذا يحيق بمن استهزأ بك.