The index is the position of an NPC or PC in the zone's entity array. For mobs and friendly NPCs it's always the same value, for players and pets it differs based on when they spawned into the zone. For mobs and friendly NPCs it's a value between 0x000 and 0x400, for players it's between 0x400 and 0x700 and for pets it's between 0x700 and 0x800.
The ID is a globally constant value for both NPCs and PCs. While NPCs have a constant index as well, the ID is the constant for PCs as well, even across servers. For players it's a value between 0x00000000 and 0x00FFFFFF, for NPCs it's anything above that. The first byte is 0x01 for almost every NPC. If it's 0x01, then the structure is as follows:
Here AA is 1, BBB is the zone ID and CCC is the NPC's index. For example if we take the ID of Harvetour in West Ronfaure, which is 17187549, and convert it to a hexadecimal value, we get 0x010642DD. If we split it up into the three parts as defined above, we get 0x01 for AA, 0x064 for BBB and 0x2DD for CCC. 0x064 is 100, which is West Ronfaure's zone ID, 0x2DD is 733, which is the Harvetour's index.
This only works for NPCs where the AA part is 1. There are certain mobs that have 2 for the first byte, which are all (to my knowledge) in Meeble Burrows, and there are a few other NPCs (like certain doors) that have 4 for the first byte. They may not follow the same pattern.