Revelation 22 gives us a picture of kingdom exclusion-- an exclusion of the unclean from the eternal kingdom of God in the new heavens and new earth and not the millennial kingdom which passed away along with the old creation.
Revelation 22:3
No longer will there be anything accursed, but the throne of God and of the Lamb will be in it, and
his servants will worship him
In contrast to the heavenly city, during the millennial kingdom people still sinned and died (Isaiah 65:20) and had the freedom to reject Jesus in their hearts and rebel against him (Revelation 20:7-9). The millennial kingdom is a demonstration that even when Jesus physically reigns on earth, if man does not turn their hearts towards Him, they are not actually in the kingdom, because God wants to reign in our hearts and not outside of it.
Revelations 22:10
And he said to me, “Do not seal up the words of the prophecy of this book, for the time is near.
Let the evildoer still do evil, and the filthy still be filthy, and the righteous still do right, and the holy still be holy.”
Here we see the righteous being juxtaposed with the unrighteous. Someone who is truly saved will continue do righteousness and the unsaved will continue to do evil (Romans 6). It is not enough to pay lip service and call Jesus Lord but God must reign in our heart (Matt 7:21-23, Isaiah 29:13, Ezekiel 33:31, Matthew 15:7–9).
Revelation 22:15
Outside are the dogs and sorcerers and the sexually immoral and murderers and idolaters, and everyone who loves and practices falsehood.
Finally we come to the ultimate kingdom exclusion verse. Outside the heavenly city where God's throne is located are those who do evil. They can't blame God because scriptures warned us many times that those who practice evil will not inherit the kingdom of God regardless if they profess to be Christians or not.
Galatians 6:8
Do not be deceived: God is not mocked, for whatever one sows, that will he also reap. For the one who sows to his own flesh will from the flesh reap corruption, but the
one who sows to the Spirit will from the Spirit reap eternal life.
Now compare Revelation 22:15 with references to the dogs (unclean), sorcerers, sexually immoral, murderer, idolators, and those who practice falsehood with Paul's warnings in the epistles.
Galatians 5:19-21
Now the works of the flesh are evident:
sexual immorality, impurity, sensuality,
idolatry,
sorcery,
enmity, strife, jealousy, fits of anger, rivalries, dissensions, divisions, envy, drunkenness, orgies, and things like these. I warn you, as I warned you before, that those who do such things
will not inherit the kingdom of God.
Ephesians 5:3-5
But
sexual immorality and all
impurity or
covetousness must not even be named among you, as is proper among saints. Let there be no filthiness nor foolish talk nor crude joking, which are out of place, but instead let there be thanksgiving. For you may be sure of this, that everyone who is sexually immoral or
impure, or who is
covetous (that is, an
idolater),
has no inheritance in the kingdom of Christ and God.
1 Corinthians 6:9-10
Or do you not know that
the unrighteous will not inherit the kingdom of God? Do not be deceived: neither the
sexually immoral, nor idolaters, nor adulterers, nor men who practice homosexuality, nor thieves, nor the
greedy, nor drunkards, nor revilers, nor
swindlers will inherit the kingdom of God.
https://www.verserain.com/html/warning_verses.html