The National Oceanic and Atmospheric Administration has a document detailing the distance between ports across North America in nautical miles. For example, the distance between the Port of New York and the Port of Miami is 1,346 nautical miles. The Ports website also calculates nautical mile distances between ports beyond North America.
The NOAA's document details distances between ports that are measured by ships sailing close and along the coast. The document covers distances between continental American ports, as well as some ports in Alaska, Hawaii, Canada and the North Caribbean. It is also capable of calculating different routes, and, by extension, different distances, through various straits and bays. A couple of examples of routes between some of the biggest American ports are 746 nautical miles between the Port of Houston, Texas and the Port of Miami, Florida and 453 nautical miles between The Port of Boston, Massachusetts and the Port of Baltimore, Maryland.
This website also has a route builder for ports anywhere in the world, including ones not covered by the NOAA, such as those in Europe and Asia. An example is a route between the Port of London and the Port of Shanghai, which results in a distance of 11,880 nautical miles. The tool also predicts how long a ship will be at sea before it reaches its destination based on distance and speed.