I'll try to cover as much as I can in this answer.
As I stated in my comment it depends on what race you are playing against, what you scout, and when you are trying to get both these buildings. Map size also factors into your decision as well.
Since you are referring as to having to make a choice, I'm going to assume that you are trying to do this off one base on a relatively smaller map so all answers below will be tailored around that assumption. If it's a big map (like Tal'darim Alter) you can quickly get a second base and do something like a +1/+1 + charge or blink attack.
So what race are you playing against.
If you are playing terran that is going a heavy bio start, a forge is a good choice with a small zealot, sentry, and stalker army. Getting a quick +1 armour will reduce marine damage to zealots to 1 with a guardian shield up (Guardian shield reduces damage by 2, zealots start with 1 armour, marines attack for 5) making them that much stronger against against a bio army.
If you scout them and they're going a tech route then it will boil down to what you plan on doing with your army and what path you will be choosing. Archons and storms do significant damage to a terran army late game. The same can be said if you go with colossi and upgrades if they don't have vikings either.
This is a tough one to make a choice because zerg can swap so quickly with their army composition. The safer choice between the two is to go forge first with a +1 attack upgrade. The +1 attack allows for zealots to 2 shot zerglings instead of 3. This increases the effectiveness of zealots versus zerglings by 33%.
That said, if they go roaches and you're heavy zealot, they can be kited forever on and off creep so you need to make sure you are fighting on your terms. A few sentries thrown in will stop them from running away so you can deal your damage. It does also mean that blink stalkers will have a significant advantage over roaches as well. Even charge would work too. But it depends on what their army composition is so you sort of need the most well rounded army possible.
Keep in mind, late game, storms are very helpful versus the swarm.
Again this comes down to army composition. If it's a stalker vs stalker fight, the player with blink will win (assuming properly blink micro).
If one of the players goes the colossi route later on, the one with the forge early with early attack upgrades will destroy the army of the guy that doesn't have the upgrades.
This mirror match-up is difficult to theorize without scouting information. If you see a forge upgrading you need to get one in response, if you fall behind you will lose. It really depends on what you plan on going for a build.
Generally speaking though forge is the safer bet. You can get quicker upgrades, and if you scout a Twilight council and dark shrine you have access to dropping a cannon to save you from Dark Templars as well without having to spend the money on a Robotics Bay and get an observer.