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:2:195

And spend in the way of Allah and do not throw ˹yourselves˺ with your ˹own˺ hands into destruction ˹by refraining˺. And do good; indeed, Allah loves the doers of good.  

And spend in the way of God, in obedience to Him, in holy struggle and the like; and cast not your own hands, yourselves (the bā’ of bi-aydīkum ‘with your hands’ is extra) into destruction, by withholding funds needed for the struggle or abandoning it altogether, because this will give your enemy the advantage over you; but be virtuous, by spending etc.; God loves the virtuous, that is, He rewards them.
القرآن:٢:١٩٥

وَأَنْفِقُوا فِي سَبِيلِ اللَّهِ وَلَا تُلْقُوا بِأَيْدِيكُمْ إِلَى التَّهْلُكَةِ ۛ وَأَحْسِنُوا ۛ إِنَّ اللَّهَ يُحِبُّ الْمُحْسِنِينَ  

{وأنفقوا في سبيل الله} طاعته بالجهاد وغيره {ولا تلقوا بأيديكم} أي أنفسكم والباء زائدة {إلى التهلكة} الهلاك بالإمساك عن النفقة في الجهاد أو تركه لأنه يقوي العدو عليكم {وأحسنوا} بالنفقة وغيرها {إن الله يحب المحسنين} أي يثيبهم.

See similar narrations below:

Collected by Bukhārī
bukhari:4516Isḥāq > al-Naḍr > Shuʿbah > Sulaymān > Abū Wāʾil

Hudhaifa said, "The Verse:-- "And spend (of your wealth) in the Cause of Allah and do not throw yourselves in destruction," (2.195) was revealed concerning spending in Allah's Cause (i.e. Jihad).  

البخاري:٤٥١٦حَدَّثَنَا إِسْحَاقُ أَخْبَرَنَا النَّضْرُ حَدَّثَنَا شُعْبَةُ عَنْ سُلَيْمَانَ قَالَ سَمِعْتُ أَبَا وَائِلٍ

عَنْ حُذَيْفَةَ {وَأَنْفِقُوا فِي سَبِيلِ اللَّهِ وَلاَ تُلْقُوا بِأَيْدِيكُمْ إِلَى التَّهْلُكَةِ} قَالَ نَزَلَتْ فِي النَّفَقَةِ