How to redirect from observer to external url in magento2..?

I want a redirect function where It will redirect to external Url from Magento 2 Observer class.

In other CMS like Wordpress, we have wp_redirect(); it will redirect to any URL inside Wordpress or to any External URL.
I am looking a similar kind of function in Magento2.

below I found a link It also not very helpful,

You can redirect to external URl by using Magento’s “resultRedirectFactory” class like

$resultRedirect = $this->resultRedirectFactory->create();
$resultRedirect->setUrl(‘https://www.google.co.uk’);
return $resultRedirect;

Thanks Varun, About code works fine in Controller class. But I want in Observer class