If a manager from one department doesn’t get along or is at odds with the manager from another department – that is how departmental wars get started. You don’t need that.
I’ve had that situation before. I was torn because I thought both were good managers. But there is probably something you are not seeing or understanding.
Every situation is different. But dig in, and find out what their grievances are. Ask questions independently and listen. Then investigate. Then get them together and talk about it. Tell them that you can’t have disagreements between departments. (You know it is spilling over to the teams in those departments.)
Give them a chance to work it out and fix it. If they don’t, you’ll have to. If someone has to go, then so be it. Choose the one who is the cause of the problem.
You have external battles to fight. You can’t be burning organizational attention and energy on internal battles.
I figured out a long time ago that if you can unify your management team, you have half the battle won. It’s hard sometimes to do that because they all think they have the answer for any certain topic, and they struggle a bit to open up to others’ ideas. Teach them how to converse and have an open line of communication at all times.