so to speak, "if" is usually used for 1 conditional sentences like "I wouldn't do that If i were you" but "whether" is usually used for 2 conditional sentences that you want to express a sentence about two different possibilities like "I haven't decided yet whether to stay or leave"
sometimes "whether" can replace "if", for example "She asked me whether I wanted to go to the party tonight" or "She asked me if I wanted to go to the party tonight"
also you have to use "whether" after prepositions like "it depends on whether it's sunny or not"
hope you got ur answer