I have two nether portals in the overworld with same X and Z coordinates but one is 8 blocks higher than the other. One of them should link to one on the Nether Roof for easy elyta flights, but the other one should link to the bottom Nether to mine Netherite. How can I do this exactly? The overworld portals are at 1600 and -5300 and the nether portals at 200 and -662. This is possible because I managed to do it once already with a lot of trial and error but can someone explain how to do this exactly? Thanks for help!
Pretty simple: if x and z coordinates are matching (what you wrote - they are) - then the portals will link to the closer portal.
Your bedrock level portal is somewhere around y=4, upper strata of bottom bedrock, your overworld top portal is at y=64, 2 blocks above sea level. Your Nether top portal is at y=129, a block above the ceiling.
Distance from the ceiling: abs(64-129) = 65. Distance from the bottom: abs(64-4) = 60. So your upper portal links to the closer one - the one at y=4. Raise your upper portal by some 3 blocks and it will work.