They are not always interchangeable.
If is used much more often, because it's more flexible. It fits in more situations.
Whether needs to be followed by a choice of options. If can precede a choice or a single statement.
Examples:
OK: if you ask me, I will tell you.
Not OK: whether you ask me, I will tell you.
But OK: whether you ask me or not, I will tell you.
Also OK: if you ask me or not, I will tell you.
OK: I will go if he does.
Not OK: I will go whether he goes.
But OK: I will go whether he goes or she goes.
Also OK: I will go if he goes or she goes.