Rope trick in 5e says:
You touch a length of rope that is up to 60 feet long. One end of the rope then rises into the air until the whole rope hangs perpendicular to the ground. At the upper end of the rope, an invisible entrance opens to an extradimensional space that lasts until the spell ends.
The extradimensional space can be reached by climbing to the top of the rope.
Movement is halved when climbing. Theoretically a character with movement of 30 feet could climb down and up a 7 foot rope during a turn by expending 28 feet of movement (7ft × 2 each way)
Given these details, if a character casts Rope Trick with a 7 foot rope and climbs into the space… then on subsequent rounds could the character expend 14 feet of movement to climb down the rope, perform an action, then expend 14 feet of movement to climb up the rope and back into the extra-dimensional space?
Taking this further… could the rope be just 3 feet in height and a wizard duck into and out of the extradimensional space each round?
Of course, the risk at this low height is that enemies might climb into the space as well. A dragon could put its head through the hole and breathe. Other mayhem is possible. But, it may also give a character in dire condition a brief respite against ranged attacks or spells.
Best Answer
The rules allow this, but...
There's nothing in the rules that prevents this from happening. However, there are a few things to consider about this tactic before employing it.
It can be immersion-breaking
Although it is technically within the rules of DnD to abuse the turn-based combat system for janky things like this, for some players this can break the sense of immersion that comes with good DnD. It can transform the fight from an epic tale about spell-slinging wizards to a videogame where you abuse the mechanics for maximum power. This kind of tactic is legal in the game, but does not make for a good story or in-universe character.
Any good DM can (and should) respond appropriately to shenanigans like this
For example, were I the DM here's how it'd play out. The first time you use Rope Trick as a sanctuary, some enemies might try to follow you up but it would mostly work out - this is what the spell is for, and it's a fun part of the game.
However, once you try the "climbing up and down" shenanigans, I'd just have enemies start readying actions. If they ready an attack, they can just attack you while you're on the rope. You could also have enemies stand at the bottom of the rope and attack your allies, and use attacks of opportunity whenever you attempt to climb back up. I also think it would be very reasonable to grant them advantage while attacking a climbing target. At this point, climbing up and down each turn is actually helping your enemies.
At the end of the day, there are a whole host of ways that climbing in and out is a poor tactical decision. That tactic leaves you spending a lot of time climbing up and down a rope, which is a poor use of movement and limits your positioning to a single location. While climbing you are fully exposed and can't use hands, but your enemies are free to reposition at will during their turns. Any slightly-intelligent enemy could use this highly advantageous situation to make your life miserable in a variety of ways.
You're missing the best use of Rope Trick
Rope trick is a fantastic spell for the use case you mentioned in the question:
However, it works better thematically and mechanically to stay in the sanctuary. You can take a few turns to use healing potions and spells, regroup, and reconsider tactics. You could even have your whole party take a short rest. Popping in and out every turn can be immersion-breaking and actually hurt more than it helps mechanically.