The word were in the phrase if I were you is special form. It is known as the subjunctive mood (from the grammatical point of view).
Today you also find the phrase if I was you. Here the Simple Past form of be is used. But there are people who say that this phrase is incorrect and would never use it (mainly Americans). Others say that this phrase can be used.
If I were you I would phone him. - subjunctive mood
If I was you I would phone him. - Simple Past