For all effective purposes, the differences are cosmetic only, not function. An M4 has a collapsible stock and a carbine length barrel, commonly 16" if you want the muzzle device (flash suppressor or muzzle brake) removeable, or 14.5", which is the military length. There is a step milled in the barrel between the front sight and the muzzle to allow the attachment of an M203 grenade launcher. Most M4 barrels are also skinny under the handguards, though there are some heavy barrels out there.
There wouldn't be any problem putting the DPMS upper on your AR15 lower unless you have a Colt with the large pivot pin holes. Then you'd need to get one of the offset pins to make it work. I'm not going to get into details about feed ramps, handguards, etc., as they really aren't germane to your question.
For most purposes, 5.56mm and .223 are the same, though there are differences. See the ammo FAQ for the technical differences.