What does Mark 9:40 mean?
After the transfiguration, Jesus, Peter, James, and John return to find the rest of the Twelve stymied by a stubborn demon which they cannot expel from a young boy (Mark 9:17–18). Now, John explains how they saw someone exorcising demons in Jesus' name. The disciples tried to stop him because he was not a known Christ-follower (Mark 9:38). Jesus explains that they shouldn't discourage people who do good work for the kingdom.This is an important point that modern believers often forget. It is good to study the Bible and learn the details of theology. It's not bad to discuss issues with people who have different views. It is bad to vilify anyone who differs in their beliefs. Our enemy is not flesh and blood but evil spiritual forces (Ephesians 6:12). If we follow Christ, we should encourage any work that builds His kingdom and be uninterested in building our own.
Taken out of context, this verse seems to contradict Matthew 12:30: "Whoever is not with me is against me, and whoever does not gather with me scatters." Jesus made this statement after the Pharisees claimed Jesus expelled demons by Satan's power (Matthew 12:22–30). The two proverbs together explain how to tell the difference between someone who follows God and someone who just claims to. Although the man here isn't apparently in close contact with Jesus (Mark 9:38), he relies on Jesus' authority to fight Satan.
In Matthew 12:30, as the Pharisees dismiss Jesus from their group, Jesus turns around and publicly excludes them from His. Jesus is merely saying that those who rely on Him are for Him and those who think He uses satanic power are against Him. Even if we don't recognize the person, we should recognize the work. If someone who doesn't follow Jesus does good work, we should encourage the work as we share the gospel.