Depends on the nature of the monster and the nature of the party.
The problem in any kind of level-based RPG is that high level parties are so diverse. It's very difficult to design a "challenging boss fight" that will suit all possible contenders. When designing a CR1 creature, you don't usually need to worry about flying invisible fire-immune PCs who can cast forcecage. Those abilities aren't usually available to your average 1st level party. But things get wacky at higher levels.
Take Imix, from the recent Princes of the Apocalypse campaign. Is your party immune to fire? Good news for you - you're about to have a cake-walk encounter. Resistant to fire? Expect a tough fight; yeah, you only take half damage from most of his stuff, but even half damage is going to be dangerous. No fire resistance? Well... good campaign. Better luck next time.
Same is true for the tarrasque. If the whole party can fly and has ranged attacks, the DM needs to come up with special tactics or environmental conditions to give the poor old Big T a chance. If, on the other hand, the party is trapped in an enclosed space with no way to escape its reach, then things are going to be much rougher.
My advice is to aim for "hard", and then pull punches if necessary.
If you go with the tarrasque, set the fight in a location where flight and teleportation can't easily take the party out of reach. Then, if they're struggling too much against it, choose a few rounds of sub-optimal tactics to give them a chance to "catch up". Target the PC with the most HP, rather than the injured guy that you can definitely punch out with a hit. Be more accommodating in terms of their wacky ideas ("The tarrasque is bogged down in the web for a round, and doesn't get to attack!"). "Forget" it's lair actions or some of its powers for a couple rounds.
If you go with Tiamat, ensure the battle is in a huge open area where she can use her flight to maximum effect. Refuse to engage PCs on the ground. Use ranged breath weapons. Add in some innocent civilians for added drama (she attacks the party's home city; their friends and families are at risk!). Again, if they're struggling, you can pull punches. Tiamat spends a round or two frying orphanages or killing a beloved friend of the party (revenge!). She gets over-confident and decides to land to finish off the PCs, exposing herself to melee attacks.
If you go the opposite route (Tiamat in an enclosed space where she can't escape or keep her distance; the tarraque in open air where the party can just fly off and finish it at range), you run the risk of creating an anticlimactic fight where a single party tactic might be able to take apart your boss monster with little challenge. But, ultimately, you need to figure out ahead of time what would constitute a unique challenge for your group. By now, you should already know what they can handle easily, and what causes them real problems.