Apple equates 1 person = 1 account. Since you are giving this to a different "person" you should follow: What to do before you sell, give away, or trade in your iPhone or iPad - Apple Support
If you want to retain some data, instead sign out of the current ID on the iPhone as below. It will ask you if you wish to retain data. Say no the ones you do not want. Then sign in with your other account.
Read this document to learn how to sign out of iCloud on your iPhone, iPad, iPod touch, Apple TV, or Mac --> Sign out of iCloud on your devices - Apple Support
For an Apple mobile device:
1. Go to Settings, then tap your name.
2. Scroll down to the bottom.
3. Tap Sign Out.
4. Enter your Apple ID password and tap Turn Off. (Read this if you If you forgot your Apple Account password - Apple Support )
5. Turn on the data that you want to keep a copy of on your device.
6. Tap Sign Out.
7. Tap Sign Out again to confirm that you want to sign out of iCloud.
Also of possible relevance:
Turn off Find My on your devices and items - Apple Support
Read this support article to learn how to sign in with an Apple Account on various kinds of devices --> Sign in to your Apple Account - Apple Support
For an Apple Mobile device:
1. Open the Settings app.
2. Tap Sign in to your [device].
3. Enter your Apple ID and password.
4. If prompted, enter the six-digit verification code sent to your trusted device or phone number and complete sign in.
If another Apple Account is signed in you may need to enter the password for that account to sign out of that account first.