What is the difference between using drupal_goto('$path') and header('Location: $path')? I've been struggling a lot with a drupal_goto() not redirecting from a view to correct path in all displays.

This is the snippet code.

/**
 * Implements hook_views_pre_render().
 */
function HOOK_views_pre_render(&amp;$view) {
  //if only on node matches, redirects to that node 
  if ( $view-&gt;name == 'FOO' &amp;&amp; $view-&gt;current_display == 'BAR' &amp;&amp; count($view-&gt;result)==1 ){
    if(is_numeric($view-&gt;result[0]-&gt;nid)){
      drupal_goto('node/' . $view-&gt;result[0]-&gt;nid);
    } 
  }
}


Instead, header('Location:node/' . $view-&gt;result[0]-&gt;nid); is working in any case. 
Why doesn't drupal_goto() work, sometimes?
I had an exposed filter with identifier named destination. Since drupal_goto() takes care of the destination parameter sent in URL with the following code, it was overwriting my code.

  // A destination in $_GET always overrides the function arguments.
  // We do not allow absolute URLs to be passed via $_GET, as this can be an attack vector.
  if (isset($_GET['destination']) &amp;&amp; !url_is_external($_GET['destination'])) {
    $destination = drupal_parse_url($_GET['destination']);
    $path = $destination['path'];
    $options['query'] = $destination['query'];
    $options['fragment'] = $destination['fragment'];
  }