Display a custom slug in URL depending on user variable

If I understand you well, I think you need to find a string like {fl or az} in the current URL and this can be done by exploding the current URL into pieces.

If you confused about the code, we assigned and checked variables like {$url_path and $url_parts} inside if statement

/* 
 * NOTES:
 *
 * get_site_url() function return the 
 * current site url without trailing slash 
 * like { **http://www.example.com/fl** } 
 *
 * FUN: parse_url: with const {PHP_URL_PATH} return the URL path after {.com}
 *
 * FUN: explode: separate words by delimiter "https://wordpress.stackexchange.com/" and {@} to avoid errors
 *
 * because of parse_url return the path after {.com} so the string 
 * {$url_path} starts with {/fl} so you we used the key number {1} not {0}
 *
 */

$site_url = get_site_url();

if( ! empty( $url_path = parse_url( $site_url, PHP_URL_PATH ) ) ) {

    if( is_array( $url_parts = @explode( "https://wordpress.stackexchange.com/", $url_path ) ) && 
        ( count( $url_parts ) > 0 ) &&
        array_key_exists( 1, $url_parts ) ) {


        switch( $url_parts[1] ) {

            case 'fl': {

                    /* === DO === */

                } break;

            case 'az': {

                    /* === DO === */

                } break;


        }

    }

}