Another solution:
I had a similar problem during an iPhone X repair. When I clicked / pressed the screen into place, the phone shut off.
I noticed that the edge of the battery was scratched. The black covering had scratched/peeled slightly, revealing some metal. And I theorized that pressing the screen near that area was causing the problem.
I covered the scratch with a piece of electrical tape and it solved the problem.