Legalism (self-righteous law keeping) and license (antinomianism-lawlessness) are heretical. The truth is that the law is good (it comes from God) and is fulfilled in love. The fulfillment of the law is to love God supremely and others equal to ourselves. If we do this, we will not worship idols, murder, adulterate, steal, etc.
Augustine: Love God and do as you please (if your motive is love, you will not disobey His loving law, nor will you be a Pharisee).
The Law can mean various things in various contexts. There is a difference between ceremonial laws for national Israel, and the universal moral law of God based on His character and being. The NT does not rescind the moral law (except a shift to the Lord's Day vs creation Sabbath).
The Law has dual purposes: It is a schoolmaster that brings us to Christ because it condemns all of us as lawless sinners (no one can keep the law apart from God).
The 10 commandments are still a basis for our Judeo-Christian legal system (what is left of it). They are absolutes for societal standards for the good of man.
They also provide a framework for Christian living subsequent to justification by grace through faith apart from law or self-righteousness. Obedience is an expression of love which is an expression of genuine faith. If you love and trust Him, you will obey Him (vs godless, selfish rebellion). The NT reiterates the principles of the moral law of God. Believers are still to flee immorality, to have no other gods before God, to honor parents, etc. This is done in the power of the Spirit that draws on His law that is written on our hearts by the Spirit instead of stone Mosaic tablets by the finger of God.