Though Luke 9:50 and Luke 11:23 at first appear to contradict, a more complete reading shows how they are both true
Mark 9:33-41 shows that the context of Luke 9:50 is Christ's and His disciples' arrival at a house in Capernaum, presumably Peter's, where He gathers them together in an intimate and friendly setting. Jesus responds to the statement from John: “Master, we saw someone casting out demons in Your name, and we forbade him because he does not follow with us” (Luke 9:49).
John implies that since the person casting out demons in Christ's name was outside of their fellowship, he should not be trusted or empowered to invoke Christ's name, even if for the performance of a good work. But Jesus corrects John: “Do not forbid him, for no one who works a miracle in My name can soon afterward speak evil of Me” (Mark 9:39).
In essence, Jesus cautions John to avoid interfering in the works that others are doing in support of the overall work. There is no good reason to discourage or make enemies out of those who are not working against us, including those whose level of belief and understanding we might judge as lacking. God can and does work with any and all persons as He sees fit, even compelling them to work for us.
The context of Luke 11:23 is expanded in Matthew 12:22-30. As opposed to the cordial environs of Peter's home, Luke 11:23 takes place when Jesus and His disciples are surrounded by a far more challenging crowd, including a hostile contingency of outspoken Pharisees. Having just cast out a demon from a man, Christ responds to the Pharisees' accusation in Luke 11:15: “But some of them said, 'He casts out demons by Beelzebub, the ruler of the demons.'”
The Pharisees charged Jesus with using the power of Satan, the ruler of demons, to cast out a demon. Beginning in Luke 11:17, He begins to deconstruct the accusation as being preposterous. In essence, He shows how, in the two-sided fight between the Kingdom of God and Satan, neither side can gain—or continue to stand—by assisting the opposition. Since there is no neutral ground between God and Satan, why would Satan help Jesus cast out his demons? By applying simple logic, Christ uses the Pharisees' own words against them, easily concluding, “He that is not with Me is against Me.”
Jesus' words in these two accounts are not at all in conflict. In fact, by combining them, we discover a unique harmony that exists between them. Though there is no neutral ground in our battle with the satanic forces arrayed against us, we should proceed with circumspection when we judge the actions of others, to be sure we understand the spirit that motivates them.