Friends usually do things together and have similar interests. Being friends with the world means adopting the ways of the world–accepting or condoning the things of the world. James refers to those who are friends with the world as adulterers and adulteresses.
Adultery is straying outside of your marriage. When the Israelites turned to other gods and indulged in idolatry, they were seen as committing adultery. They were turning away from God to pursue other gods. When we turn away from God and pursue the things of the world, we are having an adulterous relationship with the world. It is like we are going outside of our relationship with God to find something else. It seems we are no longer satisfied with our relationship with God and are searching for something better which we think the world can give us. We cannot have it both ways. We either choose one or the other.
John 3:16 states that God loves the world but the key words or message here is that whoever believes in His Son should not perish but have everlasting life. The key is for those in the world to believe in Jesus and this will lead to eternal life.
God does not want us to be friends with a world which rejects His offer of salvation and lives in rebellion. These are the people in the world with whom we are to have nothing to do with. These are people who love the things of the world more than they love God or people who want nothing to do with God.
This is not to say that we should not go out into the world and interact with people. We can’t avoid people. However, we are not to forsake our faith or compromise it because we want to maintain new or old friendships or relationships. Jesus, when He was praying for His disciples, did not ask the Father to take them out of the world. They had work to do in the world. He asked the Father to protect them from the Devil. He said that like Him, the disciples were not of the world. So, keeping ourselves unspotted in the world (James 1:27) and not being friends with the world, means that we live in the world but don’t have the mindset of the world. We cannot allow ourselves to be worldly. We are to have the mind of Christ who kept Himself unspotted from the world.
In his first letter to the Corinthian believers, Paul wrote, “In the same way, the Lord has ordained that those who preach the gospel should live from the gospel” (1 Corinthians 9:14). As Christians and disciples of Christ, we are to practice what we preach. We are to live our lives in such a way that the world will know that we belong to God and that it is Christ who lives in us (Galatians 2:20).