Can I switch from Xanax (alprazolam) to klonapine safely? I'm on 1.5 mg of xanax (alprazolam). I heard its safer for long term use.

Yes. Yes, it is possible to make this type of switch. It would be best to work with a psychiatrist who has experience in making these types of changes. It appears that you already know that you need to be careful in trying to decrease or stop xanax (alprazolam).
Not for long term. Labile mood, spastic muscular twitching, and poor sleep are common in long term use of of either one. Xanax (alprazolam) is harder to wean off.