All height restrictions are equally strictly enforced. If a piece of paper can slide out between the head and the measuring stick, it's a no-go.
Also note that not all measuring sticks are actually 40" (or the stated height). But the measuring stick is what counts. I know that Test Track and Soarin' used to have a slight variation (don't remember which one was higher), but I have no idea if that's still the case after both rides have been renovated. And one ride in California Adventure has a measuring stick that's nearly 41 inches, but "them's the breaks."
Now, 38 inches should be enough for Mine Train which is a great family ride!