Hello and welcome to RZIM Connect. Thank you for this awesome question.
These verses refer to the fact that many people will spend their lives believing a false gospel. That is, they will believe that it is the amount of things that they did that were good which will ultimately get them to heaven.
Verse 21 - Not everyone who says to me, “Lord, Lord,” will enter the kingdom of heaven, but the one who does the will of my Father who is in heaven.
What is God’s will? This is something that we must know Him and share in a relationship with Him to be able to discern. The more we know Him, through His Son Jesus, the better able we can see His will for us in our lives. It’s a journey through our lifetime of coming to know Him, and through the joy we find in coming to know Him, becoming more and more obedient and understanding of His will for us.
Verse 22 - On that day, many will say to me,”Lord, Lord did we not prophesy in your name, and cast out demons in your name, and do many mighty works in your name?” 23 - And then I will declare to them, “I never knew you, depart from me, you workers of lawlessness.”
Getting to heaven cannot be accomplished through works. It can only be accomplished by the payment for sins through the blood of Christ. He died for our sins, and in doing that, He took the fullness of the wrath and justice of God upon His shoulders. When He was on the cross there were three hours of darkness on the earth. It was during this time that that payment was made, a payment that we can never fully understand or comprehend, nor do I believe we want to. It is only through that payment that was made that we can truly be saved, through faith, not of ourselves, it is a gift from God, not of works, so that no one may boast(Ephesians 2:8-9).
Many people get confused on this matter though, and believe that there is something that they can, or must do to be saved. It is not about doing anything. It is in fact about coming to the ultimate realization that there is nothing you can do. About realizing that it is not about what we can do, but about what Christ has done.
Not one of us does good, not even one(Romans 3:12). Even the greatest of our good works brought before a holy and righteous God is like filthy rags in comparison to Him(Isaiah 64:6).
So, what hope have we? Only Christ alone. Through Him we can be made as a new creature, presentable to God through the purification of His blood for the payment of sins. It is the only way. Many miss this simple truth, that no works will save us, and that is what Jesus was referring to here. Yes, works are a natural outworking of a truly regenerate heart, but only through Christ can we truly attain that. Otherwise, we live in the deception that it is anything other than Christ, and Christ alone, who can bring us before the Father, renewed and holy.
I hope that this helps you and pray that God will guide you to the only true answer that you need Charlene. My best recommendation? Pray to God, seek His will and His guidance. Study His word and seek to grow, and know God like your life depends on it. For all of us, it truly does. If you have any other questions, please do not hesitate to ask them. God bless you and thank you.