Between Phantom Hourglass and Spirit Tracks, I prefer Phantom Hourglass.
I think Spirit Tracks has really good puzzles, and the gameplay involving Zelda is fun and unique. Traversing the overworld in a train is not my favorite. It's not bad, but I prefer everything else the series has ever tried - walking, horse riding, sailing, running as a wolf, flying a loftwing, and anything else I'm not mentioning like the animal buddies in the Oracle games. Riding a train is just inherently worse for exploration since you have to stay on tracks, but the different biomes are neat. When you get to leave the train to explore new areas, that leads to some fun exploration. The instant death from crashing into certain enemies was irritating, fast travel was probably the worst in the series of games that have it, and side quests involving the train were not my favorite. Another thing is that bunnies are cute and fun, but if you miss catching one, it's such a pain to reset the area to try again. Dungeons are fantastic in this game, but I think this is the least fun the series has ever been in terms of everything you need to do to go from dungeon to dungeon. I love this game overall, but there were a lot of things it could have done better. Lastly, the spirit flute is the single worst thing ever put in a Zelda game. I haven't had too much trouble with it relative to some horror stories I've heard, but I dread every section that you have to play with a sage.
Phantom Hourglass isn't perfect either, but I am less annoyed by its imperfections compared to Spirit Tracks and find myself more eager to replay Phantom Hourglass. I've only finished Spirit Tracks once (played deep into the game at least 3 times), but I've played through Phantom Hourglass at least 4 times. I think exploration in Phantom Hourglass is pretty great, and there are several interesting optional areas you can stumble upon in the sea. I appreciate the nonlinearity of the dungeon progression as well since that can allow the player to switch things up on different playthroughs. I don't think the dungeons and puzzles are quite as good as in Spirit Tracks, but they are still fun in Phantom Hourglass. The Tower of Spirits is better than the Temple of the Ocean King, but I don't dislike the Temple of the Ocean King. Even though it's repetitive, there are lots of different things you can do on repeated floors once you have more items so that is fun for me.
I love both games, but I think Phantom Hourglass is better.