sync my phone with two different computers, basically one for music and the other for photos.
Yes, they can all be part of your iCloud account and both signed in, with your new computer (Mac?) syncing with iCloud for the photos and the other not syncing photos - yet signed in for all other services, or any that you want it to sync. On the second computer iCloud photos will be turned off, and indeed you don't have to use Photos app at all.
If you haven't already activated iCloud sync now might be the time to set it up. This will automate your iPhone's syncing of your photos from your new Mac. I've never tried to connect an iPhone in the way you suggest - two different Macs - so I can't comment on that.
Music can be held on your second computer alone and the music synced to your iPhone.
Managing two computers is a nice dilemma to have. I have an old (2011) MacBook Pro and it's main purpose is to sync my iPod (an ancient 2005 Classic). I've found that the iPod so old - obsolete in Apple's terms - that it will no longer sync properly with my Monterey system on my primary Mac. It is however happily working on the old Mac.
They key thing though is make sure you have a Time Machine backup for each of your Macs. As they will be different they also should have separate external Time Machine backups. It might also be wise to have a separate archive of your music (not a backup). Photos will already be on iCloud, but your music will not.