Step 1: Press and hold theĀ Side buttonĀ and either theĀ Volume UpĀ orĀ DownĀ button until the 'Slide to Power Off' option appears on the screen.
Step 2: Now simply perform the 'Swipe to Power Off' operation and wait for the iPhone to shut down.
If this doesn't work, try using Siri to turn off the phone.
If that doesn't work either, there may be something amiss with this phone. If you purchased it new within the last 14 days, you have the option to return it for either a refund or a replacement. Otherwise, I suggest you contact Apple Support directly for further assistance with this matter. You can do so simply by selecting the "Get Support" link in the upper right-hand side of this forum's web page.