Jesus in Matt 23:23, was referring to God's law in which the Mosaic law & Faith are pointed to. (Law of Righteousness) Romans 3:21.
In Deuteronomy 5:31-33, Moses wrote down everything that God commanded without departing from it, so Mosaic Law was commanded by God and is thus God's law. Furthermore, the Law of Moses is referred to as the Law of God in verses like Nehemiah 8:1-8, Ezra 7:6-12, and Luke 2:22-23. The phrase "Law and the Prophets" used in Romans 3:21 also refers to the Mosaic Law.
The Mosaic law is NOT based on Faith..Galatians 3:12, so, The Mosaic law is the Law based on "works" as in Romans 3: 27.
In Acts 5:32, the Spirit is given to those who obey God, so obedience to what God has instructed is part of the way to receive the Spirit, however, Galatians 3:1-2 denies that works of the law are part of the way to receive the Spirit, therefore the phrase "works of the law" does not refer to obedience to what God has instructed. In Romans 3:27-31, Paul contrasted a law of works with a law of faith, so works of the law are of works, while he said that our faith upholds God's law, so it is of faith, and a law that our faith upholds can't be referring to the same thing as the works of the law that are not of faith Galatians 3:10-12. Moreover, in Galatians 3:10-12, Paul associated a quote from Habakkuk 2:4 saying that the righteous shall live by faith with a quote from Leviticus 18:5 that the one who obeys the Mosaic Law will live by it, so the righteous living by faith are the ones who are living in obedience to the Mosaic Law. Likewise, in Isaiah 51:7, the righteous are those on whose heart is the Mosaic Law, so the righteous living by faith does not refer to a manner of living that is not in obedience to it. God is trustworthy, therefore what He has instructed is also trustworthy (Psalms 19:7), so the way to have faith in God is by having faith in what He has instructed, to deny that what God has instructed is of faith is to deny the faithfulness of God, and it is contradictory to think that we should have faith in God, but not in what He has instructed.
Furthermore, there are many other verses like Matthew 23:23 and Romans 3:31 that connect our faith in God with our obedience to what He has instructed. In James 2:18, he would show his faith by his works. In Romans 1:5, we have received grace in order to bring about the obedience of faith. In Revelation 14:12, those who kept faith in Jesus are the same as those who kept God's commandments. In Hebrews 11, every example of faith is an example of obedience to God. In Numbers 5:6, disobedience to the Mosaic Law is referred to as breaking faith. In Hebrews 3:18-19, unbelief is equated with disobedience. In Psalms 119:30, choosing the way of faithfulness is having the Mosaic Law on our heart. In Proverbs 3:5-7, we have a choice between whether we are going to lean on our own understanding of right and wrong by doing what is right in our own eyes or whether we are going to trust in God with all of our heart to correctly divide between right and wrong through what He has instructed, and He will make our paths straight. I could list many more verses, but that should be sufficient to show that you are incorrectly identifying the law that those verses are referring to as being the Mosaic Law.