I used those two verses together because those verses are related. It is by the Spirit of God that demons are cast out according to Matthew 12:28. So the context in Matthew 7:22 and Luke 9:1-2 are that there are the 12 that Jesus chose to give the Holy Spirit to and then there are those who can perform mighty works but aren't known to God as described in Matthew 7.
Does that help you or did you read those verses a different way?
Does that help you or did you read those verses a different way?