5. If any two sides of a triangle are not equal, it is called an "irregular triangle". Among all triangles with vertices on a cube, the number of irregular triangles is ( ).
(A) 18
(B) 24
(C) 30
(D) 36
5. B.

As shown in Figure 3, let's assume the edge length of the cube $A B C D$ $A_{1} B_{1} C_{1} D_{1}$ is 1. Then the side length of the triangle can only be $1, \sqrt{2}, \sqrt{3}$, where the edge length is 1, the face diagonal length is $\sqrt{2}$, and the body diagonal length is $\sqrt{3}$.

Fix one body diagonal (such as $A_{1} C$). Then, by choosing any one of the remaining six vertices, a scalene triangle can be formed with points $A_{1}$ and $C$, resulting in 6 scalene triangles.

Since there are 4 different body diagonals, the number of scalene triangles is $4 \times 6 = 24$.