this is actually, many people who do many great works in Christ's name.
many lawless evildoers doing many great works in His name, and boasting of the many great works they did in His name.
verse 22 goes with verse 23.
But the man who loves God is known by God. 1 Corinthians 8:3
Who loves God?
“If you love me, you will obey what I command. John 14:15
This is love for God: to obey his commands. And his commands are not burdensome, 1 John 5:3
These people in Matthew 7:21-23 call Jesus Lord but do not love God.
He called them evildoers which makes it clear that no matter how great is one's faith for them to be able to prophesy, drive out demons, do miracles and to even move mountains but if they don't have love, they will be rejected and not be known by God. Even those in the church in Sardis were admonished and warned that if they do not wake up, repent and obey, He will come like a thief. (Revelations 3:3-6)
“Then they will go away to eternal punishment, but the righteous to eternal life.” Matthew 25:46
Jesus is asking once more...
“Why do you call me, ‘Lord, Lord,’ and do not do what I say? Luke 6:46
Don’t you know that when you offer yourselves to someone to obey him as slaves, you are slaves to the one whom you obey—whether you are slaves to sin, which leads to death, or to obedience, which leads to righteousness? Romans 6:16
“Behold, I come like a thief! Blessed is he who stays awake and keeps his clothes with him, so that he may not go naked and be shamefully exposed.” Revelation 16:15
Confess Jesus Christ as your Lord and Savior and Walk in Love.
God is good and His LOVE endures forever. Amen