Is there any harm in using shorter shelf brackets with a deeper shelf?
A wooden shelf that is cantilevered 3 inches or so out from the end of a bracket will probably survive some load. But stack too much of a load on it (a pantry, canned food is heavy!) and even wood will crack. Particle board is very likely to fail of course as it has very little real strength.

A shorter bracket will often be designed for a smaller load. (Long brackets may be wider at the base, to support a larger load. They may be more robust to prevent buckling.) The issue is not just will it support the entire width of the board, but is the bracket adequate to support a greater load since a wide shelf will have more items stored on it. Those extra items stored are hanging a significant distance away from the wall.