The Thingy:91 X can automatically disable UART when the USB cable is disconnected. Enable in prj.conf:
CONFIG_APP_UART_POWER_CONTROL=y
When enabled, the device monitors VBUS and automatically suspends UART interfaces when USB power is removed. This is useful for development where you need UART logging during USB connection but want to minimize power consumption when running on battery. See the UART Power Control module for details.