The sleep/wake button on an Apple iPhone is crucial for locking the device and turning it off and on; an unresponsive button can seriously limit the functionality of the phone. If the button has stopped working it may have developed a fault that requires a professional replacement or repair, although you can attempt to troubleshoot the problem yourself before getting in touch with Apple.
Issues with the sleep/wake button may be related to a software crash on the phone as well as a hardware problem, and fully resetting the device should be enough to clear up any temporary software faults. To do this, press and hold the sleep/wake button for at least 10 seconds, ignoring the red slider if it appears, and waiting until the Apple logo appears. If you are unable to perform a hard reset, plug your device into a computer to recharge it. Run the latest version of iTunes and launch the device restore option from the iTunes Summary tab.
While Apple has not acknowledged a widespread problem with the sleep/wake button on the iPhone 5, a substantial number of users have reported issues on the official Apple support forums and elsewhere. In most cases, the button became unresponsive or only worked intermittently after several months of use. If your device is still covered by its warranty, and the sleep/wake button has stopped functioning through no fault of your own, you may be able to get a replacement phone from Apple.
Apple Genius Bar
Genius Bars are available in every Apple retail store and should be your first point of call to get your iPhone analysed and replaced. You can book an appointment through the Apple website or through the Apple Store app on any iOS device. At the Genius Bar you'll be met by a qualified Apple expert who will be able to diagnose the sleep/wake button problem and suggest an appropriate fix. Be sure to back up your iPhone's data first -- via iCloud or iTunes -- before taking your device in for repair.
Other support options
If you don't want to book a Genius Bar appointment or you can't get to an Apple shop, you can access other support options through the Apple website: you can chat with a support representative online as well as arrange to post your device to Apple for repair or replacement. For other support options, check the warranty you received with your device, including any extra cover such as the warranty supplied by your mobile network operator or AppleCare Protection Plan for iPhone, which lasts for two years rather than one.