Some iPhone XS and XS Max phones won’t charge in certain situations. The problem seems to only occur when using the charging cable. The devices will not load automatically, but only start after the screen is turned on.
Due to the fact that the phone only starts charging when the screen is turned on, it seems that there is a software error in the sleep settings of the phone. These seem to incorrectly disable the plug detection process. A fairly extensive test from YouTube channel Unbox Therapy gives an idea of how often the problem occurs and in what forms. In some cases, for example, the screen cannot be turned on with the power button after connecting, but only with a tap on the screen.
There are also many reports of the problem on Reddit and the Apple forum. However, there are also reports of older iPhones and an iPad Pro showing the same behavior. That suggests that this is a software error that crept into the iOS 12 update from just under two weeks ago. Wireless charging would go without any problems. Apple has not yet responded to the reports.
The video of Unbox Therapy, limited to just the test itself