There are some breeds known as "boat dogs" and these might do best aboard.
Our Schipperke, Zorro, cruised with us for 13 years. We never had a need to take him to shore. He would leave his product on the aft deck...
..... for an easy quick rinse. He was well trained as a puppy and would run back to this "pee position" on command.
Zorro was always on watch and, typical of the breed, he would bark at other boats in passing. He would even bark in the direction of unseen vessels in the fog
He was once lost overboard
in the Pamlico Sound, but fortunately rescued and returned by another cruiser.
I would consider size, breed and training important for the success of cruising with a dog.