If you flash the xserve3,1 bootrom to a cMP 5,1 then yes that CPU would probably work however that CPU doesn't support ECC RAM, and is limited to 24Gb of RAM, so it would be a poor choice of CPU unless you already have it. Also note that this CPU doesn't support being in a dual CPU system either.
You'd be better off with the W3690 (if single socket) or dual X5690 if dual socket, as they are basically the same CPU as the one you list but have ECC and a lot more RAM support.
Once on cMP 5,1 bootrom you can easily natively load mojave if you have the right GPU installed.
Or you can load other OS on xserve now via alternative methods.
Side note of caution, you will lose some DIMM slots and probably IPMI by doing this flash, neither of these have been verified to much depth.