Compare post-IDs within WP_Query? (Less than / Greater than)

I ended up using something like this:

function filter_where( $where="" ) {
  global $post, $prev_next;
  $the_ID = $post->ID;
  $where .= " AND wp_posts.ID ";
  $where .= $prev_next=='next' ? "< $the_ID" : "> $the_ID";
  return $where;
}

add_filter( 'posts_where', 'filter_where' );
$nextProjQuery = new WP_Query( $filtered_query_args );
remove_filter( 'posts_where', 'filter_where' );  

error code: 523