Navigate to external link if last page or post in a category

Since it’s not clear exactly what you need it’s hard to give you the best solution.

However …
You should be able to use get_next_posts_link() in your loop template. Or get_previous_posts_link() if that’s what you want.

If that returns null you can then echo a link to whereever you want in your template.

if(!get_next_posts_link()) {
    echo '<a href="http://linktosomewhere.com">Continue to somewhere else</a>';
}

Won’t work in custom loops though. Then you have to reference max_num_pages.

if(!get_next_posts_link( 'whatever', $your_query->max_num_pages )) {  }