Step 1: Press Settings > General > Accessibility > Assistive Touch and turn on the Assistive Touch feature on your iPhone.
Step 2: After Step 1, You’ll find an Assistive Touch box on your screen. Tap it and click Device > Lock Screen, then slide to power off.