Use the following expression to create a unique ID for all polygons that are contiguous or have a distance of max 10 units (change that value on line 6). You could use this to create a new field with Field Calculator.
The expression creates a buffer of 10 meters around all polygons, then dissolves the result to create a multipart geometry, where every contiguous group of polygons is one part. It then checks within which of these dissolved parts the initial polygon is and assigns a unique id for this part.
You could also use the same expression, adding 2 = [expression] with Select by expression to select only contiguous polygons, here the ones with no. 2 (using the data you provided):

The expression to use:
array_max(
with_variable(
'mypolys',
geometries_to_array (
buffer (collect
(buffer (@geometry,10)
),
0
)
),
array_foreach(
generate_series(0, array_length (@mypolys)-1),
case
when within (@geometry, @mypolys[@element])
then @element
end
)
))