Context is king.
Matthew 21:28-29 But what think you? A certain man had two sons; and coming to the first, he said: Son, go work to day in my vineyard. 29 And he answering, said: I will not. But afterwards, being moved with repentance, he went. 30 And coming to the other, he said in like manner. And he answering, said: I go, Sir; and he went not. 31 Which of the two did the father's will? They say to him: The first. Jesus saith to them: Amen I say to you, that the publicans and the harlots shall go into the kingdom of God before you. 32 For John came to you in the way of justice, and you did not believe him. But the publicans and the harlots believed him: but you, seeing it, did not even afterwards repent, that you might believe him.
When you place it in context, the meaning is crystal clear: harlots and tax collectors might begin in a way of sin, but can repent and reform their ways, whereas those who say they are members, but who really live like those who are not, being hypocrites, are not really members at all: "for they say and do not," like the hypocrites (Matthew 23:3).
So at the end of the equation, there must be reform of life - there is no accepting of sin as equal to holiness, which is a perversion, not mercy — rather, mercy gives rise to holiness, via a clean slate from which to build, being now made a friend, rather than an enemy of God.
Romans 2:4 Or despisest thou the riches of his goodness, and patience, and longsuffering? Knowest thou not, that the benignity of God leadeth thee to repentance?
God forgives to the end that we might change be "be holy as I am holy." And not to the end that sin is set on par with righteousness, with only legal fiction distinguishing the two. The passion of Christ is a fount of mercy drinking from which we might be restored to order, and a good life. Which doesn't mean we can't regurgitate it wilfully, only to go back, but it does mean that righteousness is a true state, and not a legal fiction, and is tied to our real standing before God. For once you have been washed by the Lamb, you are no longer an enemy, and your works and life are not longer 'filthy rags.' In fact, this would be blasphemy, since it is written:
Philippians 2:13 For it is God who worketh in you, both to will and to accomplish, according to his good will.
For the faithful believer, when he does an actually good work, He does it by the grace of God. Therefore, to call holy living 'rags,' is to place the regenerate believer on par with the unregenerate reprobate.
1 Peter 1:16 Because it is written: You shall be holy, for I am holy.
Which is harmony with Jesus:
Matthew 5:48 Be you therefore perfect, as also your heavenly Father is perfect.
Is this a command to be absolutely perfect? Or is it a command to do your utmost (that is, your bare minimum duty as one on whom God had mercy) to be perfect? The latter.
Recall that Jesus taught:
Matthew 19:23 Then Jesus said to his disciples: Amen, I say to you, that a rich man shall hardly enter into the kingdom of heaven.
Mark 10:23 And Jesus looking round about, saith to his disciples: How hardly shall they that have riches, enter into the kingdom of God!
What does this "hardly" mean except it is difficult not to be ensared by wealth — not a bad thing in itself, but the lesson is this: how we live, and the things among which we live, can affect our suitability for salvation. It is not a matter of a disconnect between our life and our being saved. While we don't earn salvation, since mercy is a free gift of God, losing our salvation is our own doing. So while we can't earn heaven, we can voluntarily opt into hell. We merely choose between accepting the grace of God unto life, or free-falling on our own weight into hell. The former is by the grace of God, the latter is by rejecting it.
This is what Jesus meant by cutting things out of our life that cause us to sin. Exactly as above.
Matthew 18:9 AAnd if thy eye scandalize thee, pluck it out, and cast it from thee. It is better for thee having one eye to enter into life, than having two eyes to be cast into hell fire.
If we know our causes of stumbling, but refuse to remove them, then we incur the guilt of those sins. It's our fault, not God's. Just as we are expected to be responsible with our salvation by accepting the grace of God in the first place, we are just as responsible to opt out of sinful behavior with the same conviction — it is the same choice. And when I say it is the same choice, I mean you didn't really believe in Christ if He is another One than the one who commanded the above quoted.
2 Timothy 2:12-13 If we suffer, we shall also reign with him. If we deny him, he will also deny us. If we are faithless, he continueth faithful, for he can not deny himself.