It has already been pointed out that the answer is no and there is a good example to show why. On the other hand it may be worth noting that, as in the example, essentially the only way this fails is if the special fibers have ruled components.
More precisely, a theorem of Matsusaka and Mumford says that if $X$ and $Y$ are projective over the base and there are ample relative divisors (one on each) that correspond to each other on the general fiber via the isomorphism, the if the special fibers do not have ruled components, then they are also isomorphic.
For the precise statement see Theorem 2 of Matsusaka's and Mumford's paper.
The philosophical point of this question/statement is that whether this holds for a class of varieties/schemes is essentially the same as whether their moduli problem is separated, that is, if there exists a moduli space/stack/etc for them, then that moduli space is separated.
Matsusaka-Mumford's theorem implies that moduli spaces of smooth polarized varieties (at least over an algebraically closed field) are separated. If one wants to deal with more moduli spaces (say stable curves/varieties) then one needs more modern tools such as Kollár-Shepherd-Barron's results and others.
A good reference for related questions is Viehweg's book on moduli.