Export your layers to a Spatialite database (right click - Export - Save feature as)
Connect to the database in Database manager:

The query below will join the road table to the forest table and find the closest forest point for each road point. The join is based on 2D distance, so all points within 5000 m will be measured. Adjust 5000 so you're sure that the closest point is included in that distance (see my screenshot at the bottom, the closest 3D point is somewhere within 5000 m)
The closest forest is measured by 3D distance.
Adjust roadpoints
and forestpoints
below to match the names of your layers:
select r.id as roadid,
f.id forestid,
distance(r.geometry, f.geometry) as distance_2D,
min(st_3ddistance(r.geometry, f.geometry)) as distance_3D
from roadpoints r
left join forestpoints f
on PtDistWithin(r.geometry, f.geometry, 5000)
group by roadid
