Divide the line in segments and assign each segment the daynight value of the closest point:
Explode lines
Add an attribute with field calculator:
overlay_touches ('foo_points', daynight)[0]
Assign different colors based on this attribute with Categorized layer styling.
Even easier, I introduced the expression directly in the Categorized styling dialog, thus doing step 2 and 3 in a single step:
If you want to filter to catch only points with the same trip id (what seems not necessary, as long as you don't have points belonging to different trips in exactly the same spot, what seems unlikely), it's a bit more complicated. Unfortunately, filtering inside overlay functions in QGIS 3.28 still does not work as described here. But you can use this expression instead:
array_sort (
array_foreach (
overlay_touches ('foo_points', $id),
if (
attribute (get_feature_by_id ('foo_points',@element), 'trip') = trip,
attribute (get_feature_by_id ('foo_points', @element), 'daynight'),
''
)
),0
)[0]