I don't know the answers regarding the M4, but as you doubtless know, the M16 version (with a 20" barrel) is routinely used with high accuracy and precision at Camp Perry out to 600 yards.
While this is obviously well beyond the round's capability in practical defensive and offensive use (I'd guess a 55-75gr bullet is travelling maybe only a few hundred feet per second at 600 yards), the capability for hitting the target may still be quite high, given sufficient holdover (600 yards being well outside the limits of "maximum point blank range"), though its effectiveness would be poor.
I believe most folks consider it effective as an anti-personnel round inside about 150 yards, or thereabouts.
Just FWIW, I believe that the popular current trend toward barrel-shortening in military rifles is ill-advised, given the dependence of velocity upon barrel length and the need for higher velocity with lightweight bullets for sake of terminal ballistic effectiveness, especially for the "weaker" cartridges like the 5.56x45.
I do understand the desire for rifle portability and "handiness", but I consider any barrel length less than 16" with an AR15-platform .223/5.56 rifle to be an unacceptable sacrifice (in terms of ballistic effectiveness) for the degree of proportionately-minimal benefit (in terms of portability) obtained.
Best.