Is it better to have the engines center or apart on a plane? Are there any advantages or disadvantages to having the engines closer or farther to the center of the plane?

How is the ideal engine spacing determined length or span wise for performance?

Related: How is the center of mass controlled in planes with multiple tail engines?
the further apart the engines are, the worse becomes the yaw in an engine-out situation. but spacing them (and their fuel tanks) further apart along the span of a wing allows more even distribution of load stresses.