Sunan Ibn Majah 257
It was narrated that 'Abdullah bin Mas'ud said:
"If the people of knowledge had taken care of it and presented it only to those who cared for it, they would have become the leaders of their age by virtue of that. But they squandered it on the people of wealth and status in this world in order to gain some worldly benefit, so the people of wealth and status began to look down on them. I heard your Prophet say: 'Whoever focuses all his concerns on one issue, the concerns of the Hereafter, Allah will suffice him and spare him the worries of this world. But whoever wanders off in concern over different worldly issues, Allah will not care in which of these valleys he is destroyed.'" (Da'if)
Another chain with similar wording.
حَدَّثَنَا عَلِيُّ بْنُ مُحَمَّدٍ، وَالْحُسَيْنُ بْنُ عَبْدِ الرَّحْمَنِ، قَالاَ حَدَّثَنَا عَبْدُ اللَّهِ بْنُ نُمَيْرٍ، عَنْ مُعَاوِيَةَ النَّصْرِيِّ، عَنْ نَهْشَلٍ، عَنِ الضَّحَّاكِ، عَنِ الأَسْوَدِ بْنِ يَزِيدَ، عَنْ عَبْدِ اللَّهِ بْنِ مَسْعُودٍ، قَالَ لَوْ أَنَّ أَهْلَ الْعِلْمِ، صَانُوا الْعِلْمَ وَوَضَعُوهُ عِنْدَ أَهْلِهِ لَسَادُوا بِهِ أَهْلَ زَمَانِهِمْ وَلَكِنَّهُمْ بَذَلُوهُ لأَهْلِ الدُّنْيَا لِيَنَالُوا بِهِ مِنْ دُنْيَاهُمْ فَهَانُوا عَلَيْهِمْ سَمِعْتُ نَبِيَّكُمْ ﷺ يَقُولُ " مَنْ جَعَلَ الْهُمُومَ هَمًّا وَاحِدًا هَمَّ آخِرَتِهِ كَفَاهُ اللَّهُ هَمَّ دُنْيَاهُ وَمَنْ تَشَعَّبَتْ بِهِ الْهُمُومُ فِي أَحْوَالِ الدُّنْيَا لَمْ يُبَالِ اللَّهُ فِي أَىِّ أَوْدِيَتِهَا هَلَكَ " . قَالَ أَبُو الْحَسَنِ حَدَّثَنَا خَازِمُ بْنُ يَحْيَى، حَدَّثَنَا أَبُو بَكْرِ بْنُ أَبِي شَيْبَةَ، وَمُحَمَّدُ بْنُ عَبْدِ اللَّهِ بْنِ نُمَيْرٍ، قَالاَ حَدَّثَنَا ابْنُ نُمَيْرٍ، عَنْ مُعَاوِيَةَ النَّصْرِيِّ، - وَكَانَ ثِقَةً - ثُمَّ ذَكَرَ الْحَدِيثَ نَحْوَهُ بِإِسْنَادِهِ .