Loyalty tridents sometimes seem to disappear (or actually disappear) when thrown right before the player travels between dimensions. They behave very inconsistently, and almost randomly.
In most cases, the trident stays as an entity in the dimension it was thrown in, and promptly returns to the owner. However, it might also fail to return, in which case it might go through the portal and end up in the location of the portal in the overworld.
Sometimes, the trident seems to disappear, but is actually teleported to a specific location in the world, which seems to be near world spawn. It might stay as an entity (despawning eventually due to MC-125817), or drop as an item.
The trident should always return to the player, or drop as an item in the spot as soon as the player teleports, which is what happens if you die before the trident returns (MC-176919).