The order and motive is important.‘’You are justified apart from obeying the law but the justified will obey the ten commandments’’ for example. In the real world, that will practically speaking place the believer under righteousness of obeying the law. They can only be in a righteous state if they obey it.
You are justified apart from obeying the law.
You are not obeying it to be saved and know that you can not save yourself by obeying it.
It only takes one sin to result in eternal death. So you know you are lost even if you obey every law perfectly from that point on.
But because of God wonderful Love for us you want to obey it. Because you love Jesus you want to follow Him.
Do I follow the commands to be saved or because I love Jesus for saving me?
Motive is love
You keep then as a result of your faith and desire to serve.
Luk 6:46 And why call ye me, Lord, Lord, and do not the things which I say?