Star Trek and Star Wars are arguably not the same genre. Star Wars is a Western.
Actually ST was the one that was kinda sorta pitched as a Western -- "Wagon Train
to the stars." (Although, contrary to popular belief, that was more in reference to Wagon Train
's storytelling format than its genre.) And it's built around the trope of pioneers braving a dangerous frontier, part of the core mythology of the American West (as well as the Great Trek of the Boers in South Africa, which seems likely to have inspired the show's title). Star Wars
is a sword-and-sorcery fantasy transposed into outer space. It's explicitly presented as a fairy tale: "A long time ago in a galaxy far, far away." And it's about people who fight with swords, wield magic, and rescue princesses while battling evil emperors, without a frontier in sight. Sure, it has some Western trappings, along with trappings of just about every other genre Lucas was ever a fan of, but Westerns aren't its primary syntax.