A coastal city (i.e. a city whose City Center is on a coastal tile) can produce naval units, but is subject to attack by naval melee units. A coastal District or tile improvement is subject to pillaging by naval raider units and any other naval unit that can perform Coastal Raids.
Thanks to the mechanics of the Harbor, it is possible to build an inland city that can build naval units like a coastal city, but is not subject to attack by naval melee units. However, such a city must be located within 3 tiles of the coast (the maximum possible distance for district placement).
In Gathering Storm, a Canal can be constructed on a tile between two Coast and/or Lake tiles (or a coastal city and one such tile) to allow naval units to pass through it and increase the Gold yield of Trade Routes. In addition, coastal lowland tiles are given a Coastal rating of 1–3, which indicates how high they are above sea level and when they will be flooded and submerged by rising seas as the world's climate changes.