A man and his dog who were taking a walk on the beach had to be dramatically rescued by Fleetwood RNLI after being caught out by the tide.