Ships were definitely effective in siege warfare during the gunpowder age and the industrial age - effectively from the time when cannons became small enough to install in ships until the time they were made redundant by air power.
Despite being relatively fragile, ships were extremely concentrated artillery units. Fleets often outgunned the cities they were attacking - for example the British fleet that attacked New York in 1776 had many times more guns at its disposal than the city. A moving ship, while unarmoured, is also much harder to hit with a cannon than a static city.
Ships also had the advantage of manouverability. The British set a few ships upriver of New York to cut off supplies and reinforcements. They are also faster to move than most shore-based cannons, allowing the attackers to concentrate fireon a part of the defences without warning.
Shipboard artillery was used very effectively in World War 2 - for example at Normandy and in Italy as well as much of the Pacific. Combined with air support, but able to maintain station indefinitely, they destroyed fortifications and infrastructure and suppressed the movement of reinforcements. Battleships USS Wisconsin and USS Missouri provided gunnery support during the Gulf War, 1991. Arguably they remain useful today, although planes and missiles have replaced guns as the primary weapons of choice.