As other have pointed out, it depends a lot on function.
For a warship: A Spherical Hex Lattice
Space combat in any realistic since is all about hitting your enemy before they can hit you. This means you want to minimize your hit profile to the absolute minimum so that all else being the same, you can reliably evade hits at longer ranges than you opponent and kite them until they are taken out.
Lattice ships allow you to evade a shot by letting it pass through your ship rather than having to move all the way out of the way such that small course corrections are all you need to dodge a shot. The spherical part is because it means you can take many hits without your ship losing any meaningful pieces and the reason for the hex shapes are because it breaks up straight lines meaning enemy ships can't reduce thier firing solutions to a single dimension of guesswork.
This answer to a similar question goes over this in more detail. https://worldbuilding.stackexchange.com/a/152967/57832
For a warship where system requirements dont allow a lattice: a Flat Ship
Flat ships have all of the same advantages as the spherical hex lattice, but to much lesser degree. Flat designs like flying saucers can by strafing up and down use smaller course corrections to dodge. They also allow for decent distribution of systems without having any attack vector that makes you easy to cut in half or overpenetrate right through all of your major systems at once.
It is actually funny that the Enterprise is referenced as such a bad shape since many federation ships would fall into this class of flat ships. The Enterprise NX-01, the Steam Runner class, the Akira class, and the Defiant class are all pretty decent designs for warships, especially in context of federation technical limitations for how Gene Roddenberry described federation warp drives to work.
For a Fast Ship: A Cigar
If your ships experience inertia while accelerating or friction from the albeit thin atmosphere in space, then it will be most important to optimize your hull against stress in the vector of your acceleration which is best done with a long narrow ship. These also minimize profile much like the previous 2 ships, but a single broadside hit is more likely to cut you in two or a single nose shot could overpenetrate you from bow to stern wrecking your whole ship; so, they are not quite as good of a military design.
For a Freighter: An Accessible Modular Cigar
Cigar for the same reasons as a fast ship, but optimising the time spent in port is also a huge aspect of logistics. Modern freight companies solve this problem with the use of cargo container ships. The factory loads the container, the container is placed on the ship in an easy to access manor, then the containers are unloaded ready to be put on trucks to go to thier destination. Saving a single second loading or unloading a ton of cargo can save days worth of port time on a larger freighter cutting into profit margins by a large %. The key here is that your cargo containers need to be highly accessible from the outside of your ship to minimize the time and effort of loading and unloading it.
For a Cheap Ship: A Solid Sphere
A solid sphere minimizes the amount of materials spent on making a structurally sound hull; so, you are just left paying for the thinner internal walls and necessary systems. This is the single worst design profile for a warship because it makes you easy to hit from all sides while offering many opportunities to hit vital systems with just about any projectile damage profile. That said, things like colony ships, mining ships, single use craft, etc might frequently use this design.