There are no rules for how to measure your movement when how much movement you get changes in the middle of your movement. So when you change from horizontal flight to a dive, when you change from flying to walking or vice versa, and so on, are all completely undefined. I am as certain as you can be about this. I have looked high and low for these rules, I have checked every book I could think of—Player’s Handbook, Dungeon Master’s Guide, Monster Manual, Rules Compendium, Draconomicon, Dragon Magic, Races of the Dragon, I even perused the Rules of the Game articles—nothing. I have mentioned that complete absence in the rules several times on this very site, in fact.
I searched because it came up while I was writing alternate movement rules, and I felt that I needed to understand how the existing worked in every detail before I changed them. This particular detail very simply isn’t explained anywhere.
The suggestion I have seen the most people consider to be the most “fair” is to pro-rate your movement based on how much movement, proportionally, you have used. So if you have a 60-ft. flight speed and a 30-ft. land speed, and you fly 40 feet before landing, you have used ⅔ of your flight speed, meaning you should have ⅓ of your movement left—10 feet now that you’re on the ground.
The problem is that this is non-trivial arithmetic that you could potentially have to do every round. Every time you shift to a different speed, you have to calculate
$$d_\text{remaining} = \left(1 - \frac{d_\text{used}}{d_\text{old speed}}\right) \times d_\text{new speed}$$
That is just begging for mistakes to be made. Not every value for \$d_\text{used}\$ is going to be a small, neat fraction of \$d_\text{old speed}\$ like 40 is to 60, nor is the resulting fraction necessarily going to evenly divide \$d_\text{new speed}\$ as ⅓ does to 30. And if you shift speeds more than once it just gets more complicated.
So while this is the “most fair” ruling, it is a problematic one for gameplay. Maybe it’s OK if it comes up once or twice, but it is not going to work well if it’s happening several times a combat. In fact, if that were to happen, I would probably program a little web app to perform exactly that calculation so that we weren’t forced to try to do it in our heads or break out pencil and paper to do it by hand—but I’m a web developer who could do something like that in about five minutes, which isn’t true for everyone, obviously.
Failing that, you have to resort to something “less fair,” probably something like “if you have used less than half of your movement in one speed when you switch speeds, you can use half of the new speed.” Halving, rather than \$1 - \frac{d_\text{used}}{d_\text{old speed}}\$, is something you can probably reliably perform—and it doesn’t change every time, so you only have to calculate it once.
That, or you just ban it altogether, and say you cannot change speeds mid-movement. If you want to move before take-off, you have to move into position and then take-off next turn. If you land, you cannot move on the ground until next turn. And so on. Very simple to run—no math—and the complete lack of rules for this might imply it is “intended,” but it’s also very limiting in ways that seem very strange and don’t fit the narrative well at all.
I suppose you could go the other way and allow someone to just use each of their movement modes in full, but I have never seen anyone suggest that is fair—the fly spell already doubles most character’s movement speed, for it to instead potentially triple it is a bit, well, preposterous. I wouldn’t run things that way, certainly.
All of that said, as it turns out, I have literally never had this come up in any game I have run or played in. It seems like this thing that really ought to be covered and have rules, and that like those rules would come up, but they just... don’t. Flying is so good that there is just no reason to ever stop doing it, so once you can, you largely forget about your land speed. And swimming comes up almost never. My groups do tend to have a gentlemen’s agreement not to use burrow speeds, which would cause it to come up more, so that could be a source of problems here if you use them—but again, I suggest you don’t because they cause a lot of logistical headaches for the DM and can wind up ignoring large portions of the adventure.