By default, your iPhone waits 1 minute before automatically locking itself (the "lock screen" is shown in the screenshot). After that, you'll need to swipe, enter your passcode (4-digit pin), and/or unlock the phone with your fingerprint (Touch ID). The screen dims sooner, especially if you upgraded to iOS 9, but your iPhone / iPad / iPod touch won't be locked until a full minute has passed.
You can make your phone auto-lock itself sooner (30 seconds), make it wait as long as five minutes before it goes to lock screen, or completely disable auto-lock by telling it Never to lock itself. That last setting, while practical and tempting, is the least secure, because anyone who can get their hands on your iPhone can then access its content, send emails on your behalf, and worse!
From the home screen, tap on the Settings app (gear icon). Scroll down to the General options (third group from the top), and tap on them.
Now find the Auto-Lock setting (fifth group from the top) - it will show in gray text your current lock timeout (1 minute, by default). Tap on it.
Pick your favorite timer, between 30 seconds and 5 minutes. As long as you are willing to risk the problems associated with disabling the auto-lock timer altogether, you can tap on Never at the very bottom. Your new setting is automatically saved once you made your selection, and you can click on the Home button and resume using your iPhone. If you want to test it, the auto-lock timer starts x minutes after you last interacted with your phone or tablet.