There is not a unique ID number for every hazardous substance. For substances which are mixtures of assorted chemical compounds, the Hazmat name might be something like corrosive substance, acidic, inorganic, n.o.s. (n.o.s. stands for not otherwise specified) and that name will cover a lot of different mixtures.
All those mixtures will have similar hazardous behaviors and their ID number is the same. Their behavior will be similar in an emergency situation and emergency responders will treat them the same.
If you look in the emergency response guide, you will see that the same response guide number applies to a wide variety of materials, and that's because they will behave similarly and be treated similarly in an emergency.