Avoid executing a function (redirect) if I’m in the admin area

There isn’t a WordPress core function to check if we are in the login or register page, but we can create one using the $pagenow global as mentioned in this answer.

function is_login_page() {
    return in_array( $GLOBALS['pagenow'], array( 'wp-login.php', 'wp-register.php' ) );
}

Then we can use this function in a Guard Clause, which, is a nice way to avoid nested conditionals:

function my_redirect_function() {

    // exit early if is in admin site or login/register pages
    if ( is_admin() || is_login_page() ) {
        return;
    }

    // check for a specific capability is a better practice as we can have
    // a more granular control of who can or can't do something
    if ( !current_user_can( 'manage_options' ) ) {
        // do your thing in here
    }
}

I hope it helps. Please note that I checked for a specific capability instead of a role because it allows a more granular control of who can or can’t do something.