Is it safe to switch from one h2-blocker to another?

Yes. H2 blockers are a class of generally safe medications used to treat acid reflux/heartburn. The mechanism of how they work is the same, there are some differences in side effects between different products.
Yes. They are generally equally effective at bioequivalent doses. Cimetidine (tagamet) has a lot of drug interactions and should be avoided if you take other medications.