“Now we know that whatever the law says it speaks to those who are under the law, so that every mouth may be stopped, and the whole world may be held accountable to God. For by works of the law no human being will be justified in his sight, since through the law comes knowledge of sin.” -Romans 3:19–20
Paul uses the word “law” here in the widest sense possible, the Hebrew Scriptures, to include the prophets and the books of wisdom. As a matter of fact, of all the passages he quoted above (vs 10-18), none were actually from the Pentateuch.
Paul has removed any claim the Jewish people might make in saying they are more righteous than Gentile. So by condemning the Jews with their own law which only highlighted their glaring failures, Paul silences all claims by his imaginary Jewish interlocutor to be in any way morally superior to Gentiles.
He has, in essence, stopped their mouths. Since the Jewish people are no better than Gentiles, then the whole world stands condemned before God.
He concludes with an application drawn from Psalm 143:2: “Enter not into judgment with your servant, for no one living is righteous before you.” Now that it is clear that all are condemned, then the deeper purpose of the Law becomes even more clear. It cannot justify anyone because no one can keep it. It can only condemn because it highlights our moral failures by making our sin known.