"just in case" means "only because there is a very small chance" (that something may happen). It's quite common in a clause that begins with "but". ) I don't see how it can be replaced by "if".
New words, one handy idiom, and a 2-minute quiz — delivered to your inbox to keep your streak alive.