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:4:140

And it has already come down to you in the Book that when you hear the verses of Allah ˹recited˺, they are denied ˹by them˺ and ridiculed; so do not sit with them until they enter into another conversation. Indeed, you would then be like them. Indeed Allah will gather the hypocrites and disbelievers in Hell all together -  

It has been revealed (read active nazzala, ‘He has revealed’, or passive nuzzila, ‘It has been revealed’) to you in the Book, in the Qur’ān, in sūrat al-An‘ām ˹Q. 6:68˺, that: (an has been softened and its subject omitted, in other words, ˹read it as˺ annahu) ‘When you hear God’s signs, the Qur’ān, being disbelieved in and mocked, do not sit with them, that is, the disbelievers and the mockers, until they engage in some other talk, for otherwise you, if you were to sit with them, would surely be like them’, in sinfulness. God will gather the hypocrites and disbelievers, all together, into Hell, just as they were gathered together in this world in unbelief and mockery.
القرآن:٤:١٤٠

وَقَدْ نَزَّلَ عَلَيْكُمْ فِي الْكِتَابِ أَنْ إِذَا سَمِعْتُمْ آيَاتِ اللَّهِ يُكْفَرُ بِهَا وَيُسْتَهْزَأُ بِهَا فَلَا تَقْعُدُوا مَعَهُمْ حَتَّىٰ يَخُوضُوا فِي حَدِيثٍ غَيْرِهِ ۚ إِنَّكُمْ إِذًا مِثْلُهُمْ ۗ إِنَّ اللَّهَ جَامِعُ الْمُنَافِقِينَ وَالْكَافِرِينَ فِي جَهَنَّمَ جَمِيعًا  

{وقد نزَّل} بالبناء للفاعل والمفعول {عليكم في الكتاب} القرآن في سورة الأنعام {أن} مخففة واسمها محذوف، أي أنه {إذا سمعتم آيات الله} القرآن {يُكفر بها ويستهزأ بها فلا تقعدوا معهم} أي الكافرين والمستهزئين {حتى يخوضوا في حديث غيره إنكم إذا} إن قعدتم معهم {مثلهم} في الإثم {إن الله جامع المنافقين والكافرين في جهنم جميعا} كما اجتمعوا في الدنيا على الكفر والاستهزاء.