These words appear to be synonymous, so I checked to see the difference on Wikidiff which gives the following definitions:
One who governs a country, province, or colony as the representative of a monarch.
One who rules in place of the monarch, especially because the monarch is too young, absent, or disabled.
I also checked thesaurus.plus which uses the same definition for each and also notes the following:
Viceroy and regent are semantically related. in director topic. In some cases you can use "Viceroy" instead a noun "Regent"
Despite that, I did not see a clear difference. What exactly is the overlap? Where is the difference? When would you use one over the other?