5. The number of ways to choose 3 vertices from the 8 vertices of a cube such that at least two vertices are on the same edge is ( ).
(A) 44
(B) 48
(C) 50
(D) 52
5. (B).

From 8 points, taking 3 has $C_{8}^{3}=56$ ways. The number of ways to take any two points not on the same edge is what we are looking for.

Since any two points of the three points are not on the same edge, the lines connecting each pair are face diagonals, and thus each way of taking corresponds to a regular triangular pyramid (as shown in Figure 3) $S-XYZ$. Since the cube has 8 vertices, there are exactly 8 such regular triangular pyramids, so the number of ways to take any two points not on the same edge is 8, resulting in $56-8=48$ (ways).

In fact, the three points that satisfy the condition form a right-angled triangle, and there are 48 such right-angled triangles.