Defer all js except certain ones in functions.php file

I supposed that you are trying to set defer for every JS exclude jquery.min and jquery.ui.core.min.

Based on that I have made some changes into your code and this will set defer for all JS exclude given example files jquery.min and jquery.ui.core.min.

function add_defer_to_cf7( $url )
{
    //If  not js file OR js file with 'jquery.ui.core.min' OR 'jquery.min' name string, then no need to apply defer
    if(FALSE === strpos( $url, '.js') || ((strpos( $url, 'jquery.ui.core.min') > 0) || (strpos($url, 'jquery.min') > 0))){ 
        return $url;
    }
    else{
        //set defer for .js files
        return "$url' defer="defer";        
    }
}
add_filter( "clean_url', 'add_defer_to_cf7', 11, 1 );

Above code set defer=”defer” for all JS excluding ‘jquery.ui.core.min’ and ‘jquery.min’ and this is what you want. Good luck!

Thanks!