Find points of interest near a path?

One-liner, assuming the POI points are stored in a "geography" column, you supply the ids of the two points and the search radius in meters:

WITH line AS (
  SELECT ST_MakeLine(p.geog::geometry, q.geog::geometry)::geography AS geog
  FROM pois p, pois q
  WHERE p.id = :id1 and q.id = :id2
)
SELECT p.name, p.id
FROM pois p
JOIN line
ON ST_DWithin(p.geog, line.geog, :radius);

Only complication is that the geography points have to be cast to geometry to access the line building function, and the line has to then be cast back to geography for use in the distance query.