How to turn my iphone off when my lock button is stuck?

How do i turn my iphone off when my lock button is stuck?

Go to settings > General > accessibility > scroll down and tap Assistive Touch > turn it on

You'll have the little icon pop out with a white circle in the middle. You can drag it around to change to position. If you tap it, you have 4 options that come up. Tap the Device option, and you can lock your iPhone from there.