Some may argue using Qur’an verses to prove we cannot be friends with disbelievers, however these verses in context are in reference to specific situations. Some point to Abdullah Ibn Ubayy and his companions who were enemies of the Prophet ﷺ, some of them are about our adab (character) not being like those of the hypocrites, because the munafiqeen (hypocrites) used to take disbelievers as friends over the muslimeen. Even though these verses are about specific matter, some scholars also used them to say in general we cannot befriend disbelievers.
The munafiqeen would also befriend muslims to then betray them and share their secrets to the disbelievers who they were at war with like what happend during the Battle of Uhud.
However we have evidence from The Prophet ﷺ that we are are not allowed to befriend disbelievers, Imam At Tirmidhi graded the hadith, Hasan (good) of the Prophet ﷺ saying
“Do not accompany except a believer, and do not serve your food except to one with Taqwa”
“اتصاحب الا مؤمنا ولا يأكل طعامك الا تقي”
At-Tirmidhi narrated from Samurah ibn Jundub that the Prophet ﷺ said not to live with the mushrikin (polytheists) or stay with them, and whoever does so is like them. Al-Hakim narrated a version where the Prophet ﷺ said such a person is not from us. Al-Hakim and adh-Dhahabi both said the hadith is on the condition of al-Bukhari and Muslim.
This hadith applies to anyone who stays with the mushrikin (polytheists) by choice, not those who are forced or weak. Abu Dawud and at-Tirmidhi narrated that the Prophet ﷺ said he is free from any Muslim who stays among the mushrikin. When asked why, he said that their fires should not be able to see each other, meaning they should not live close together.
At-Tabarani and al-Bayhaqi narrated a wording that whoever stays with the mushrikin, the protection is removed from him. Imam Ahmad explained that the phrase about their fires means not to stay in a place where each can see the other’s fire at night.

Translation: And it was narrated by at-Tirmidhi (d. 279AH) with suspension in a firm way, and he said: And it was narrated by Samurah ibn Jundub (d. 60AH) may Allah be pleased with him from the Prophet ﷺ, he said: Do not live with the mushrikin (polytheists) and do not stay with them. So whoever lives with them or stays with them, then he is like them.
And it was narrated by al-Hakim (d. 403AH) in his Mustadrak (Collection of Additional Hadiths) with a connected chain from al-Hasan (al-Basri, d. 110AH) from Samurah (d. 60AH) may Allah be pleased with him from The Prophet ﷺ, he said: Do not live with the mushrikin (polytheists) and do not stay with them, so whoever lives with them or stays with them, then he is not from us. Al-Hakim said: It is authentic upon the condition of al-Bukhari (d. 256AH) and Imam Bukhari and Imam Muslim did not narrate it. And Ad-Dhahabi (d. 748AH) in his Talkhis said: It is upon the condition of al-Bukhari and Muslim.
And what is seen from this hadith is that it is general for all who stay with the mushrikin and live with them by choice, not by force or weakness.
And it was narrated by at-Tabarani (d. 360AH) in al-Kabir, and al-Bayhaqi (d. 458AH), and their wording is: He said: Whoever stays with the mushrikin (polytheists), then the protection is removed from him. And in this hadith and the hadith before it, there is a severe warning for those who stay with the mushrikin (polytheists) and live with them by choice.
Al-Fadl ibn Ziyad said: I heard Ahmad (Ahmad ibn Hanbal, d. 241AH) may Allah have mercy on him being asked about the meaning of: Their two fires should not be seen by each other. So he said: Do not stay among the mushrikin in a place where if you light a fire, they would see your fire, and if they light a fire, you would see their fire. Rather, go far from them.
And from them is what was narrated by Imam Ahmad (d. 241AH), al-Bukhari (d. 256AH) in his Tarikh (History), an-Nasai (d. 303AH), and Abu Ya‘la (d. 307AH) from Anas ibn Malik (d. 93AH) may Allah be pleased with him from the Prophet ﷺ: that he said: Do not take light from the fire of the mushrikin (polytheists).
Some ulama (scholars) said: Its meaning is: Do not come close to them in homes in a way that you are with them in their lands, but rather go far from them and migrate from their lands.
And Ibn al-Athir (d. 606AH) said: Its meaning is: Do not seek their advice and do not take from their opinions, and he made light a likeness for opinion in times of confusion.
I say: And this saying is narrated from al-Hasan al-Basri (d. 110AH).
Ithaf al-Jamaa bi-ma jaa fi al-Fitan by Hamud bin Abdullah al-Tuwaijri (3/344-345)
Shayk Bin Baz was asked: A Christian lives with me, and he says to me: My brother and we are brothers, and he eats and drinks with us. Is this action permissible or not?
The Shayk responds and says: The kafir (disbeliever) is not a brother to the Muslim. Allah says, the Most High: (Truly, the believers are brothers) (al-Hujurat:10). And the Prophet ﷺ said: (The Muslim is a brother to the Muslim). So the kafir, whether he is a Yahudi (Jew) or Christian or Wathani (Idol-worshipper) or Majusi (Fire-worshipper) or others, he is not a brother to the Muslim.
And it is not allowed to take him as a companion and a friend. But if he happens to eat with you sometimes without you taking him as a companion or a friend, and it just happens that he eats with you, or in a general gathering, then there is no problem.
But taking him as a companion, a friend, someone to sit with, and someone to eat with, is not allowed. Because Allah has cut off between us and them in loyalty and love.
Allah, the Most High, said in His Great Book: (Indeed, there is for you a good example in Ibrahim and those with him, when they said to their people: We are free from you and from what you worship besides Allah. We have disbelieved in you. And between us and you has appeared enmity and hatred forever, until you believe in Allah alone) (al-Mumtahinah:4).
And He, the Most High, said: (You will not find a people who believe in Allah and the Last Day loving those who oppose Allah and His Messenger, even if they were their fathers, or their sons, or their brothers, or their relatives) (al-Mujadilah:22).
So what is necessary upon the Muslim is to be free from the people of shirk (associating partners with Allah) and to hate them for the sake of Allah. But he should not harm them or cause them trouble or go beyond limits against them without right.
But he should not take them as companions or close friends. And if it happens that they eat with him, or he eats with them in a general gathering, or in some food that happened without companionship, loyalty, or love, then there is no problem.

Al Qurtubi says Allah has forbidden believers from taking disbelievers, Jews, and people who follow desires as close associates or confidants. They should not seek their opinions or entrust them with their matters. It is also said that one should not converse with those who follow a different way or religion.
A poet said that a person’s character is known by the company he keeps. The Prophet ﷺ said that a person follows the religion of his close friend, so he should be careful about whom he befriends. Ibn Mas‘ud said that people can be judged by their companions.

Translation:
Allah, the Almighty, has forbidden the believers in this verse from taking the kuffar , the Jews, and the people of desires as close associates and confidants. They should not consult them in opinions, nor entrust their affairs to them. And it is said: Everyone who follows a madhhab (way) and religion different from yours, you should not converse with him.
The poet said: Do not ask about a man, but rather ask about his companion,
For every companion follows the one he is with.
And in the Sunan (Traditions) of Abu Dawud (d. 275AH), from Abu Hurairah, from the Prophet ﷺ, he said: (A person is upon the religion of his close friend, so let one of you look at whom he befriends).
And it was narrated from Ibn Mas‘ud (d. 32AH) that he said: Judge people by their companions.
Tafsir Al Qurtubi (5/272-273)
Befriending kuffar | Shayk Ibn Uthaymeen رحمه الله
Shayk Ibn Uthaymeen says having love for disbelievers is a major sin
What is your advice for a person who befriends a Christian and eats and drinks with him? | Uthman Al-Khamees
