How to get a list of vertices from a list of edges in bmesh?
Use sets.
Will most likely be duplicates in the following vertex list, from any connected edges.
selected_verts = [v for e in bm.edges if e.select for v in e.verts]

Converting to set(...) will have only one member for each vertex.
 set(selected_verts)

or defining as set in first place.
selected_verts = {v for e in bm.edges if e.select for v in e.verts}

The set(...) sounds like the way go as you can check intersection between sets of vertices easily.
between sets.