From what I've read they're tricky to pin down because they didn't have an exact role – or rather the term could be applied to ships fulfilling a number of roles.
As best I can tell active fleet ship through to hulk was more a spectrum than a clear-cut hierarchy. As such 'guardship' could include ships expected to go sea and ships not expected to sail.
A role seems to have been as a ready reserve for local defence. All navies of the era appear to play the bureaucratic numbers vs economy games during peacetime, and many of the ships listed in the fleet would actually have been 'in ordinary': no crew, de-stored, possibly even de-gunned and de-masted. It would take months to get them back to active status so guardships fulfilled an intermediate state as at least partially crewed & stored and able to sail in a few days for local operations.
Another significant consideration until steam came along was prevailing or fickle winds preventing the main fleet from coming to the rescue. I read of one case where a ship waited 4 weeks to get out of Portsmouth! Certainly for the British a French fleet sweeping down on Plymouth & Falmouth whilst much of the fleet were held up at Spithead and Chatham seems to have been a significant concern.
Finally, given the ships were there they'd undoubtedly pick up extra duties as some or all of flagship/headquarters, training ship, receiving ship, stores ship, etc.