How can I power off an iPhone if the screen is not working (because it's broken or not detecting touch)?
Well, the iPhone restarts because pressing the Home and Power buttons simultaneously for a longer period is actually the way to force a restart (on the iPhone 6S and earlier). I think you're simply holding them too long.