“And we know that in all things God works for the good of those who love him, who have been called according to his purpose.” - Romans 8:28
We know that God works for the good of those who love him in all things, but we forget it too, when we let the world crowd Him away from our hearts. He has written the law on our hearts, and we are aware of right and wrong when we walk with Him, but we must do that regularly. Or we aren’t walking with Him.
Paul is writing from persecution which he faces. These words are a comfort for those persecuted. You overcome it and it is defeated. Or you succumb, and yet He holds you. You are mortal and will die. Yet He has given you eternal life in His kingdom. A day in His kingdom as servant is better than a thousand days in a corrupt court as a noble.