The best, in my opinion, Star Trek episodes involve ships in a battle setting.
Doomsday Machine, balance of terror any number where the ship and its crew fight enemies while traveling through space.
In the movies 2, 6 , 8, 11, 12and others with strong space battle sequences.
Just my personal taste in these things
Probably my favorites, too. STNG where Picard is captured, “There are four lights!” and a regular military type takes over the Enterprise and tells Troy to get into something appropriate. Or the battle scene where a future Riker commands his own warship at the temporal breach.