Turn off your iPhone by holding the sleep/wake button for a few seconds, which brings up a slider that reads "slide to power off." Simply slide it, and your iPhone powers down.
If the sleep/wake button is not functioning, there is still away to turn off your iPhone. First, launch the settings app on your phone, tap General, tap Accessibility, tap AssistiveTouch and turn AssistiveTouch on. A circle button should appear on your screen. Tap that, and tap Device in the menu that pops up. Press and hold the Lock Screen option. This should bring up the "slide to power off" bar, which you can then slide to turn off your iPhone.