As @SupportiveEntity says, you can use dot product and relative rotation as the measurement of distance from the target rotation.
Applying the torque can get a little tricky, but if you’d like to get advanced, I’d suggest using something like a PID controller.
Credit to Chuck Noble for his PID controller linked here:
Add Torque to physics controlled player, to return roll to zero - Programming & Scripting / Blueprint - Epic Developer Community Forums (unrealengine.com)
I haven’t used this free PID on the Unreal Marketplace, but it could be good (there are a couple of paid ones too)
PID controller in Code Plugins - UE Marketplace (unrealengine.com)
Hopefully, if UE goes to a fixed physics tick in UE5.5 and onwards (it’s in discussion) this will help physics simulations run deterministically/consistently on different speed machines.