It would be a similar sort of procedure, where he needs to turn things off before signing out. So for example with icloud photos, see Get help with iCloud Photos - Apple Support
”How do I turn off iCloud Photos on only one device?
You can turn off iCloud Photos on a single device when you follow these steps:
- On your iPhone, iPad, or iPod touch, go to Settings > [your name] > iCloud > Photos, then turn off iCloud Photos.*
- On your Mac, go to System Preferences > iCloud. Next to Photos, click Options, then deselect iCloud Photos.*
- On your Apple TV 4K or Apple TV HD, go to Settings > Accounts > iCloud. Under Photos, press Select to turn off iCloud Photos.*
If you have Optimize Storage turned on, you might not have all of your original photos and videos on your device. To download the original photos and videos on your iOS device, go to Settings > [your name] > iCloud > Photos and select Download and Keep Originals. On your Mac, open Photos, choose Photos > Preferences, then select Download Originals to this Mac. Then you can turn off iCloud Photos. You can also select the photos and videos that you want to download from iCloud.com.
Before you turn off iCloud Photos, you might want to make a copy of your photos and videos.”
He can also transfer those photos to a computer first for safe keeping as well - Transfer photos and videos from your iPhone, iPad, or iPod touch - Apple Support.
With messages, he should be able to sign out of iMessage and his current messages will remain on his phone. If there are really important messages though, he may be best to use some software for his windows or mac and transfer them to there for safekeeping as well. A software used by Mac users here is Phoneview (https://www.ecamm.com/mac/phoneview/) and for windows there are similar tools (I think one mentioned by users on these forums is iExplorer or similar name).
The main reason to sign out of iMessage is to dissociate his iPhone’s telephone number from your iMessage account so when he signs back in with his own, new AppleID his iMessage account will pick up his telephone number.
But backing up things like photos and messages independently of iCloud is never a bad idea for safekeeping important data, and especially when making changes. Phoneview is not overly expensive and it lets you create an archive of your texts that can always be read at anytime since they are now saved as just basic text files on your computer.