Summary over sets of points
I am not entirely sure I understood you, but maybe something like this:

select t.id, 
       sum(p.dist) as trip_distance, 
       array_agg(p.dist) as dist_values,
       array_agg(p.id) as points
from gpspoints p
  join trip t on p.id between t.start_point and t.end_point
group by t.id;


For the following sample data:

create table gpspoints  (id int primary key, dist numeric);
create table trip (id integer primary key, start_point int, end_point int);

insert into gpspoints 
values
  (1, NULL),
  (2,  2.3),
  (3,  4.4),
  (4,  1.7),
  (5,  1.2),
  (6,  2.7);

insert into trip
values
  (1, 1, 4),
  (2, 2, 3),
  (3, 3, 5);


The query returns:

id | trip_distance | dist_values        | points   
---+---------------+--------------------+----------
 1 |           8.4 | {NULL,2.3,4.4,1.7} | {1,2,3,4}
 2 |           6.7 | {2.3,4.4}          | {2,3}    
 3 |           7.3 | {4.4,1.7,1.2}      | {3,4,5}  


The columns dist_values and points are just there for debugging purposes to validate that the correct points were included.