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:39:18

Who listen to speech and follow the best of it. Those are the ones Allah has guided, and those are people of understanding.  

who listen to the words ˹of God˺ and follow the best ˹sense˺ of it, which is that which contains ˹the means to˺ righteousness for them. Those, they are the ones whom God has guided; and those, they are the people of pith, the possessors of intellect.
القرآن:٣٩:١٨

الَّذِينَ يَسْتَمِعُونَ الْقَوْلَ فَيَتَّبِعُونَ أَحْسَنَهُ ۚ أُولَٰئِكَ الَّذِينَ هَدَاهُمُ اللَّهُ ۖ وَأُولَٰئِكَ هُمْ أُولُو الْأَلْبَابِ  

{الذين يستمعون القول فيتبعون أحسنه} وهو ما فيه صلاحهم {أولئك الذين هداهم الله وأولئك هم أولوا الألباب} أصحاب العقول.