Star Trek is a soft science fiction space opera that has a heavy focus on philosophy, politics, ethics, the future of science, the future of humanity, etc. It's very intellectual and tries to basically immerse the viewer in thinking about future problems and deals heavily with post-modern themes. It's full of submarine-style action and space adventure with subtle but exciting sequences and is almost exclusively episodic in its presentation; meaning every episode or movie tackles a different plot and presents different themes. Star Trek was a way for Gene Roddenberry to get secular humanism, libertarian socialism, futurism, optimistic science, and multi-culturalism out into the mainstream of the film and TV industry so to inspire people to think about and invest in a better future.
Star Wars is a science fantasy space opera that basically tries to present an epic mythology in the future. Literarily, Star Wars shares most elements with the epic poems and myths throughout human history as well as the modern high fantasy genre, but differs in that it's told on a far future stage and takes advantage of several SF tropes. Its primary goal is to tell a good, exciting story of epic proportions in the romantic mode. It doesn't bother itself too much with deep philosophical, ethical, socio-political, and scientific questions like Star Trek, but instead focuses on telling a beautiful heroic story. It has bursting, colorful, exotic action scenes and presents a very well done heroe's journey using hyperadvanced and unexplained science to get the characters where they want to go and do the things they want to do with style.
Both are space operas, but that's about where the similarities end. ST and SW are very different franchises that wish to create very different products, but both are deserving of high praise an admiration. Personally, I love both franchises a lot, but my favorite of the two has to be Star Trek.