Yes, they can and here is why!  The Pythagorean Theorum tells us that there is a relationship between the 2 sides and the hypotenuse (the side directly across from the right angle) of a right triangle.  The formula a^2 + b^2 = c^2.  ^ means squared.  So, 18 squared (18 x 18 = 324) + (24 x 24 = 576) = 900.  30 x 30 = 900, so it is possible for these to be the side lengths.  This would be a right scalene triangle.