At the moment Nearby Interaction that is using UWB ranging to compute precise distance/angle can be run when the app is in the foreground only and that is a design decision by Apple (probably due to the privacy implications).
What you might try is to use Core Location and/or iBeacon to detect "enter into the range" event that will work in the background (assuming user gave proper permissions).
Once user enters the range of e.g. smart lock then you can push a message to open the app and switch to UWB ranging with Nearby Interaction API once that app is in the foreground.