???
This is a bit complicated, but here's the skinny:
In hypothetical statements, "if I were" is the correct form of the subjunctive mood, a grammatical mood used in hypotheticals or other non-real (irrealis) statements. An example would be "if I were you, I would talk to her today". It's hypothetical because you are not someone else! These hypotheticals are almost always followed by "I would" in the next clause.
The trend in modern English is that this subjunctive form is dying out. Many people would say "If I was you, I would talk to her today" and not bat an eye. To me, this sounds ungrammatical. To others, it sounds fine.
But note that English allows the word order to be inverted (and the "if" omitted) and here only "were" is acceptable. "Were I a few years younger, I'd probably be out there right now." (Again this is non-real; you are not a few years younger). No one would say "Was I few years younger..." in this example. Even people who say "If I was you..." would agree that "Was I few years younger..." makes no sense.
Here's where it gets more complicated:
"If I was..." is grammatically correct if it is not a hypothetical or non-real event that you are expressing. It is correct if you are using "if" to refer to something in the past. "If I was ever mean to you, I apologize". This is correct because it is referring to a possible event in the past, not a hypothetical event in the future. "If I were ever mean to you..." by contrast implies that it hasn't happened yet, but it might in the future. "If I was ever mean to you..." implies that it has already happened in the past.
These types of statements are rarer, however, and most of the time you're probably going to be using "if" in hypothetical statements, and thus "If I were..." is probably going to be correct.