When I use my GPS app or I want to use my Bluetooth headphones I need to turn on those services, but only in those scenarios, once I’m done using them I don’t want them to be always on, is there a way to automatically turn them off is they are not being used?

I tried Tasker but the “Turn off Bluetooth if not being used” profile wasn’t working at all.