After washing your cast iron pan (or any other cast iron cookware), ensure there’s no water on it and the cookware is completely dried.
If there’s moisture, it will lead to oxidation, resulting in rusty surfaces.