Можете да използвате between
на MySQL и limit
клауза за това:
$range = 5; // you'll be selecting around this range.
$min = $rank - $range;
$max = $rank + $range;
$limit = 10; // max number of results you want.
$query = "select * from table where rank between $min and $max limit $limit";