You do that by using a single Apple account and then set up iCloud to sync items between devices. You can also sync with a computer but it is a bit more seamless with iCloud. Disable iCloud for specific features you do not want to sync. So if you only want photos on one of your devices, turn off iCloud syncing of photos on the other device.
The advantage of doing this is convenience. Let's say you add a Contact on your iPhone. If you are syncing contacts via iCloud then when you look in the Contacts app on your iPad the new contact will appear there too.
Here's some reading. ;-)
This document basically tells you how to sign into iCloud --> Set up iCloud on all your devices --> Sign in to iCloud on all your devices - Apple Support
Change your iCloud feature settings [iOS and Mac] - Change which apps sync and store data with iCloud - Apple Support -
"When you turn on iCloud for an app, its information is safely stored in iCloud and automatically kept in sync across your devices. When you turn it off, the app will no longer connect with iCloud, so your data will exist only on your device. You can choose which apps on your device you'd like to use iCloud, or turn off iCloud completely."
When you turn off an iCloud feature on a device, information stored only in iCloud for that feature is no longer available on the device. If you turn off Mail, Contacts, Calendars, Notes, Reminders, or iCloud Photos on just one device, you can still view and change your information on iCloud.com and on another device you set up for that feature.
General information on how to "Set up your iPhone, iPad, or iPod touch" - Set up your iPhone or iPad - Apple Support
Sign into iCloud on all your devices --> Sign in to iCloud on all your devices - Apple Support
This article explains how to use iCloud on an iPhone
Use iCloud on iPhone - Apple Support
How iCloud keeps information up to date across all your devices
How iCloud keeps information up to date across all your devices - Apple Support