I once had a serious spiritual crisis over this question. In Galatians 3, Paul seems to say the law is no more, and there are many scriptures saying the law is eternal. I felt that if God is truth, then there could be no contradictions, all scripture must agree or God is not truth. When scripture did not turn up the answer I went to history of that period for an answer. I felt I had to have a definition Paul meant by the words he used for law. I made sure my historians were top level, as accurate as possible. I made sure the authors had worked on the dead sea scrolls as they were the oldest sources of that history, and that they had a top level education from such as Harvard or Yale. This was not taking history as scripture, but learning what the words used in scripture truly meant.
Here is what I found. There were many foreigners who were attracted to Judaism, it was popular to join the Jews. Many joined for a time and then left for the parties and celebrations of the heathens, taking Jew friends with them. This problem was addressed by the leading Scholars of the time like Hillel, Shammai, and Gamaliel. They made up 18 rules the gentiles must follow to join the Jews. Several historians of this time mention this but not one listed those rules, so we know they were made but not what they were.
In those days, people discussed the news of the day just like today, and there was a general outcry over these rules. Read what Paul said about them in Acts. They were called the Law of Moses. No one thought of the law of Moses as the ten commandments as we do today, they thought of those 18 laws that had to be followed if they were allowed to make the one true God their God. We know that fleshly circumcision was included, Paul speaks of that.
For me, this made all scripture agree with every other scripture.
However, the ten commandments can be incorrect as true law. For example, the fourth commandment about the Sabbath. If it is obeyed legalistically rather than from the heart, you could think you were keeping it holy by going to church and disobeying it actually by ignoring someone in need. So the ten commandments are only good as under the new covenant, given in the heart.