Use the Field Calculator to create a new field (the group ID field) with an expression like this:
CASE WHEN "common_attribute" = 'value1' THEN 'group1'
WHEN "common_attribute" = 'value2' THEN 'group2'
WHEN "common_attribute" = 'value3' THEN 'group3'
WHEN "common_attribute" = 'value4' THEN 'group4'
Repeat the WHEN...THEN ...
You can try Openrouteservice.org, where the results are downloadable in the GeoJSON file. Afterwards, you can easily manipulate them i.e. in the interactive map builder like GoogleMyMaps.
Apart from Openrouteservice.org in this article, you will find another useful tool. I would ...
QGIS 3.8 offers a new tool for this: Join attributes by nearest. You can find it in the toolbox. (For older versions theres the NNJoin plugin, which basically does the same, as csk already mentioned)
As joining lines can be complex (intersections, nodes and stuff like that, resulting in "incorrect" results), I suggest to go a workaround using points on ...
I had to perform a similar task using three different, but related, roadway centerline datasets from multiple different providers.
What I ended up doing was to decide which layer represented the desired physical features and location. For you, it would appear that is would be the "blue" data.
Next, you use the Snap Geometries to Layer function in QGIS to ...