The EFI specification specifically states that there are no limits on this detail:
UEFI does not impose a restriction on the number or location of System Partitions that can exist on a system.
(Version 2.5, p. 540.)
As a practical matter, putting the ESP first is advisable because this location is unlikely to be impacted by partition moving and resizing operations. For instance, suppose the ESP exists between OS A and OS B partitions, and you decide to delete OS B and give its space to OS A. In this case, you'll need to move the ESP before you can expand the OS A partition. Also, some tools, such as
/dev/sda1 as the default location for the ESP. Thus, if you place the ESP elsewhere and then forget to override the defaults, you can create an unbootable entry.
Putting the ESP at the end of the disk can work almost as well in most cases, but there are some subtle problems with that approach. For one thing, if you change the number of partitions, the number of the ESP may no longer match its position on the disk, or some partitioning tools may renumber it. Either outcome can cause confusion or require reconfiguration. Also, if you use RAID and add disk space, an ESP at the end of the disk will suddenly become one in the middle, which may require you to move it.
Many pre-installed Windows systems put the ESP at position #2, with #1 being occupied by a small manufacturer-specific partition. Such a configuration works fine, and since the manufacturer's partition is also unlikely to be moved or deleted, this configuration isn't really any worse than putting the ESP at position #1. I wouldn't go out of my way to "fix" such a configuration, but I also wouldn't do it that way myself, if I were given a blank disk and told to start installing OSes.
Overall, if you have some compelling reason to create an ESP at other than the first position, feel free to do so; but if you're starting with a blank disk and have no compelling reason otherwise, I'd put the ESP first.