The dimensions of the radiating area of your subwoofer(s) determine the frequency range of their directivity. It's often said that bass is omnidirectional, however that's only true to for wavelengths longer than the height and/or width of your subwoofer or subwoofer array. The longer the dimension, the lower the frequency at which the array can achieve some directivity. This isn't a huge factor with just 2 single 18" subwoofers but the effects get more noticeable as subwoofer arrays get bigger...
Now, that said, the ground is effectively a mirror to bass. This is called half-space radiation. 2 side-by-side subs are mirrored by the ground to provide the effective output of a block of 4 subs in full space. The side-by-side subs present a larger dimension to the ground/mirror and the effect is slightly lower frequencies will be constrained and reflected by the ground.
The short answer is, side-by-side will provide slightly better performance at slightly lower frequencies. Stacking vertically will provide slightly better performance at slightly higher frequencies. The corollary to that is that side-by-side will provide slightly narrower horizontal coverage and stacking vertically will provide slightly wider horizontal coverage.
If you have 4, stacking them in a cube will give you the best overall result. Putting them all side-by-side will start to narrow the sound field slightly, and won't seem as loud up close but it is likely that it will provide response that is _slightly_ deeper on axis and farther away.