I highly recommend against doing this. If you use another account to purchase apps and or media, when you move to a new device or reset your phone, those apps will require you to enter the password for the other account in order to download. Also, if that other account gets closed those apps and media will no longer be available.
It might be easier to just create a family share and include the other account in the share. This will allow you to share iCloud space as well as media and apps. Now, to recover the apps from the other account, go to the App Store, click on you image in the upper right hand corner. Then click “Purchased”. Here you will see each members of the group, and can click on the other account t name(s), and download any apps purchased by that account. Saved having to swap IDs all the time.