Reports coming from several different sources claim that some brand-new iPhones are not charging unless their screens are on. This issue apparently affects both the iPhone XS and XS Max. However, the reports also suggest that this problem is software based, yet not constant across all devices.
https://www.notebookcheck.net/Charge-gate-Emerging-reports-of-charging-port-issues-in-some-iPhone-XS-and-XS-Max-units.336510.0.html