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:8:1In the name of Allah, the Entirely Merciful, the Especially Merciful.

They ask you, ˹O Muhammad˺, about the bounties ˹of war˺. Say, "The ˹decision concerning˺ bounties is for Allah and the Messenger." So fear Allah and amend that which is between you and obey Allah and His Messenger, if you should be believers.  

‘They question you, O Muhammad (s), concerning the spoils of war — the booty — to whom do they belong? Say, to them: ‘The spoils of war belong to God, Who places them where He will, and the Messenger, who divides them according to God’s command. The Prophet (s) divided these ˹spoils˺ between them equally, as reported by al-Hākim in his al-Mustadrak. So fear God and set things right between you, that is, ˹set right˺ the reality of that ˹state of affairs˺ which is between you, through mutual affection and the refraining from quarrelling; and obey God and His Messenger, if you are, truly, believers’.
القرآن:٨:١بِسْمِ اللَّهِ الرَّحْمَٰنِ الرَّحِيمِ

يَسْأَلُونَكَ عَنِ الْأَنْفَالِ ۖ قُلِ الْأَنْفَالُ لِلَّهِ وَالرَّسُولِ ۖ فَاتَّقُوا اللَّهَ وَأَصْلِحُوا ذَاتَ بَيْنِكُمْ ۖ وَأَطِيعُوا اللَّهَ وَرَسُولَهُ إِنْ كُنْتُمْ مُؤْمِنِينَ  

{يسألونك} يا محمد {عن الأنفال} الغنائم لمن هي {قل} لهم {الأنفال لله} يجعلها حيث يشاء {والرسول} يقسِّمها بأمر الله فقسَّمها ﷺ بينهم على السواء، رواه الحاكم في المستدرك {فاتقوا الله وأصلحوا ذات بينكم} أي حقيقة ما بينكم بالمودة وترك النزاع {وأطيعوا الله ورسوله إن كنتم مؤمنين} حقا.