When I used three DS18B20s for temperatures at different heights in a hot water tank, I didn't bother sorting out which DS18B20 was in which position. I just took the highest temperature reading to be the physically highest, etc.
As others have mentioned, there are a lot of ways of finding out and storing all the IDs. You can compare the IDs with what was stored previously, so you would know that identification is needed if any have changed.
The best method depends on what operational procedure or other circumstances apply for you. You might want a button to learn new ones, or there might be some way of identifying each in turn from the temperature profile.
You could have a routine like this:-
If the stored IDs don't correspond to the searched ones, or there aren't exactly 5 searched IDs, go into a calibration mode. (You should have a few tries and several seconds of the wrong IDs before going into calibration mode)
In calibration mode, wait until exactly one ID can be found. Store it as being the first.
In calibration mode with the first ID only stored, wait until exactly two IDs can be found. Store the newcomer as being the second.
In calibration mode with the first two IDs only stored, wait until exactly three IDs can be found. Store the newcomer as being the third.
In calibration mode with the first three IDs only stored, wait until exactly four IDs can be found. Store the newcomer as being the fourth.
In calibration mode with the first four IDs only stored, wait until exactly five IDs can be found. Store the newcomer as being the fifth, and leave calibration mode.
You could easily make the system where it could be powered off between each learning of IDs, if that helps.
As long as the user can tell if the system isn't working, nothing else would be needed. If the system stopped working, the procedure would be to disconnect all but the first sensor, and then connect one at a time until it worked.
An indication that a new sensor had been found would be needed if the user can't otherwise tell which sensor is faulty.