There is some overlap of meaning, but, as a general rule, "malfunction" usually suggests that the thing continues to do something (just not what it's supposed to do), whereas "stop functioning" usually suggests that it has stopped doing anything. In your example, "malfunctioned" is preferable. "Stopped functioning" suggests that the ride didn't move at all, in which case it wouldn't have injured the girl (presumably).
New words, one handy idiom, and a 2-minute quiz — delivered to your inbox to keep your streak alive.