They are targeted to the same market, sub-compact/super-mini. The Sonic is slightly larger, particularly sedan because of the trunk.
I looked at both (hatchback versions) and bought a Honda Fit, slightly smaller yet (outside and weight) but more usable space in cargo mode. FWIW, space in Fit with seats down is bigger than space behind second seat of a Yukon, no other subcompact hatch sold here comes close. You have to move up to compact size (Focus, Matrix, Soul; there is no Cruze hatch and the HHR is gone) to get more cargo room inside than a Fit.
Until 2015 model year, Ford was bringing only a Fiesta hatch to U.S.; for a sedan in this size you needed Sonic, or look for equivalents from Toyota, Hyundai, Kia, or Nissan.
Tom Test
Itasca Spirit 29B