This hadith is recorded in Saheeh Bukhari under two chapters. One of which is: 

    باب إذا لم يكن الإسلام على الحقيقة
    
    Chapter: If one does not embrace Islam truly

It is recorded in Saheeh Muslim under two chapters:

    باب تألف قلب من يخاف على إيمانه لضعفه
    
    Chapter: Being kind to one for whose Faith there is concern because it is weak


    باب اعطاء من يخاف على ايمانه
    
    Chapter: Giving to one whose faith one fears

The relevant part of the hadith is:

>### إني لأعطي الرجل وغيره أحب إلي منه خشية أن يكب في النار على وجهه
>
> I give to a person while another is dearer to me, for fear that he might be thrown on his face in the Fire by Allah.

The person for whom the Prophet ﷺ feared is the one to whom he *did* give the charity. This person was new to Islam and his iman was weak. It was feared that he might begrudge being neglected in favor of a senior Muslim, and could develop animosity and misgivings towards the Prophet ... which would lead him to Hell as it is Kufr. 

So the Prophet chose him for the purpose of inclining his heart towards Islam and to allow for iman to take roots.

>### إنما الصدقات ... والمؤلفة قلوبهم
>
> Zakah expenditures are ... and for bringing hearts together [for Islam] 
>
> <sup>— [Quran 9:60](http://quran.com/9/60)</sup>

On the other hand, regarding the person to whom the Prophet did not give: the Prophet was confident that his iman was already resolute and that it would not be harmed by him being overlooked in the distribution.

See: https://al-maktaba.org/book/1711/426#p1 https://al-maktaba.org/book/1673/563#p1