Video from GotQuestions.org
"Who are the people that Jesus will say he never knew? Is it possible for God to not know someone? What does Matthew 7:23 mean? In this video, Pastor Nelson with Bible Munch answers the question, “What did Jesus mean when He said, ‘I never knew you. Depart from me’”?" from the video introduction.
Jesus said, “Then I will tell them plainly, ‘I never knew you. Away from me, you evildoers!’” (Matthew 7:23). It seems strange to hear our all-knowing Lord say there’s something—or someone—He doesn’t know. Jesus refers not to an intellectual knowledge here but to a relational knowledge.
To understand a verse, always start with the context. Jesus is wrapping up His Sermon on the Mount with a final warning about true faith. Jesus predicts that false Christian prophets will be coming as wolves in sheep’s clothing (Matthew 7:15). They may use all the right “God talk” and even make impressive displays of power, but they will not belong to the Lord:
“Not everyone who says to me, ‘Lord, Lord,’ will enter the kingdom of heaven, but only the one who does the will of my Father who is in heaven. Many will say to me on that day, ‘Lord, Lord, did we not prophesy in your name and in your name drive out demons and in your name perform many miracles?’ Then I will tell them plainly, ‘I never knew you. Away from me, you evildoers!’” (Matthew 7:21–23).
In Jesus’ words on Judgment Day, we see several important truths: it’s not a verbal claim that one follows Jesus that saves (Matthew 7:21). Nominal Christianity cannot save. Also, it’s not a demonstration of spiritual insight or power that saves (verse 22). A person can seem like a Christian in the eyes of other people, yet still be an “evildoer” in God’s sight and sent away from His presence (verse 23). Only those who do the Father’s will and who are known of God will enter heaven.." from the article: What did Jesus mean when He said, “I never knew you. Depart from me”?