In Matthew 7:20-23 Jesus said, “Not everyone who says to Me, ‘Lord, Lord,’ will enter the kingdom of heaven, but he who does the will of My Father who is in heaven will enter. Many will say to Me on that day, ‘Lord, Lord, did we not prophesy in Your name, and in Your name cast out demons, and in Your name perform many miracles?’ And then I will declare to them, ‘I never knew you; depart from Me, you who practice lawlessness.’
Are the “many” here trying to enter heaven by their works (did we not prophesy in Your name, and in Your name cast out demons, and in Your name perform many miracles)?
To find out who the Lord was speaking to, we have to back up to Matt. 7:15 where the passage begins. There we discover He had false prophets in view. They will not have done the will of the Father, which according to John 6:40 is to look to the Son and believe in Him.
Instead they are like bad trees that produce bad fruit, claiming that they’re working in the name of the Lord while they spew forth false prophecies and counterfeit miracles. Jesus said they never were believers (“I never knew you”) but instead practice lawlessness, and He will deny them entrance to the Kingdom.