Set conditional on template based on referring page slug

I ended using the wp-get-referer function in a conditional. Here’s the resulting code:

<?php
    $ref1 = parse_url(wp_get_referer()); //getting the referring URL
    if($ref1["path"]=='/services-we-provide/')
:?>
    //Do stuff
<?php else: ?>
    //Do other stuff
<?php endif ;?>