If and whether are fascinating but tricky words. Both are conjunctions, and sometimes they mean the same thing. Sometimes.
Webster’s New World Dictionary includes this definition for both words: “used to introduce an indirect question.” In that case, you can use the terms interchangeably without changing the gist of the sentence:
Sometimes, a writer will use if or whether to express a condition. The two words take on similar but slightly different meanings in conditional clauses. In conditional clauses, if means “on condition that; supposing that,” whereas, whether often means “in either case that,” so that the clause includes alternatives.