Starting in generation 3, the game stores a random 32-bit number (0 - FFFFFFFF) for every Trainer to differentiate them from others with the same name.
In generations 3-6, the game takes this 32-bit number and displays the lowest 16 bits of the 32, which ranges from 0-65535, as the visible Trainer ID. The remaining 16 bits are the invisible "secret" ID, also 0-65535.
For trainers originating in generation 7 and beyond, the game instead displays the 32-bit number as a decimal number, but only displays the lowest 6 digits. Since the 32-bit number ranges from 0-4294967295, we have 6 digits to display, and a value 0-4294 (or 4293 depending on the lowest 6 digits) as the invisible "secret" ID.
If you want to enter a 5-digit ID, then make the Trainer data (Pokémon) originate from an earlier generation. When you change it back to Gen7+, the displayed values will be equivalent. If you hover over the text boxes, the program tells you the other representation.