USB Restricted mode works like this — one hour after iPhone, iPad, or iPod Touch was last locked, it will basically disable the Lightning port. Making it only usable for charging. If something is plugged into the Lightning port after USB Restricted mode has been enabled, it will not function unless the device is unlocked again.
After installing iOS 11.4.1 on your device, USB Restricted mode is automatically enabled by default. How to enable it?