While it's always a good idea to wipe your iPhone before selling it or passing it on to someone else, it's not uncommon for some folks to forget this important step, especially if they're just handing an old iPhone down to a friend or family member. Hence, if you've acquired a used iPhone from somewhere, you may find that it's still signed into the Apple ID of the previous owner, which can be a pretty frustrating situation as it makes it difficult for you to make your new iPhone truly your own.
Depending on whose Apple ID you're using, this may be more than just an inconvenience. Using an iPhone that's fully signed in to someone else's Apple ID means that you'll be syncing data like your photos and messages with their iCloud account instead of yours, and it's likely they can even track its location via Apple's Find My iPhone. Even if they're a close friend or immediate family member, you may not want them to have that level of access to your personal life.