“For I say to you that unless your righteousness surpasses that of the scribes and Pharisees, you will not enter the kingdom of heaven" (Matt 5:20).
Were the scribes and Pharisees trusting God? No they were not. No one can please God, no matter how many good things they do, if they refuse to trust Him. When a person trusts God, He regards their trust as righteousness. If a person's work is a result of trusting God, He is pleased with that. That's living faith (James 2:17). If a person believes that God does not love sinners, and consequently tries to earn His love (which the scribes and Pharisees were trying to do), then none of their works will be pleasing to Him; their starting point is the belief that God does not love them; their starting point is doubt; their starting point is disbelief. When a person works to earn God's love, He regards their works as filthy rags. (Isaiah 64 is talking about a people who were not trusting God; that's why their works were disgusting to Him.)
Many believe that the Bible teaches that a person cannot have a relationship with God unless they are sinless. But this is mistaken. Sinners can have a relationship with God if they start to trust Him. God does not require perfection for a relationship with him to begin, all He requires is trust.