If you end up in South Wales (rather than North Wales) there are also ferries from Pembroke Dock to Rosslare with Irish Ferries and from Fishguard to Rosslare with Stena Line.
Then you take the train from Rosslare to Dublin Pearse or Dublin Connolly (depending where in Dublin you need to get to).
If taking the ferry route and not driving to the port then by far the best option financially via any of the ports is to use the Sail-Rail option where train (in the UK) and ferry are on one ticket.
You can book that through any rail operator, although the scheme is run by Transport for Wales, so maybe best on their website/app.
At Fishguard and Holyhead you just walk off the train into the terminal (at Fishguard use Fishguard Harbour Station, not Fishguard and Goodwick), at Pembroke Dock it is a taxi or a bit of a walk (but not a bad or long walk).
On the Stena Boats if you want a bit of quiet on the ship upgrade to the Hygge Lounge, or to the Stena Plus lounge. The latter is rather like an airport business class lounge- you get alcohol, drinks and nibbles (not a bad range at all) for free. Or you have a full range of meals for extra at your seat. It's an enhanced menu to what is in the main restaurant. Very civilised. Irish Ferries has similar- the Club Class Lounge.
At Dublin with Sail/Rail you then pay the extra 3 Euro (or whatever it is now) for the shuttle bus into the City Centre.
Via Rosslare you need to book the onward train separately with Irish Rail. It is quite a scenic run up the coast, and includes a section at Wexford where the train runs down the street like Amtrak at Oakland, CA.
The station at Rosslare is just outside the terminal, about 300 yards if that. It used to be inside the terminal, and the trains had a full restaurant car on (long gone).