The bottom line is that weight machines are almost always an inferior way to exercise. You will get less results for the effort you put in from a machine than you will from using freeweights. Much of their supposed safety advantage is an illusion, and in some cases they may actually be more likely to cause an injury. In short, for most people they are a poor choice for resistance training.
To understand why this is so, we need to look at what happens when you pick up something heavy with a compound lift. A few muscle groups (the targets) are doing most of the work in the motion of 2 or more different joints (e.g. knees and hips) as you push or pull the weight. But there are also other muscle groups that provide assistance to the major muscle groups (the synergists), and there are still other groups that are contracting without moving to provide stability (the stabilizers).
By contrast, most machine exercises are isolation movements, which involve only 1 kind of joint (e.g. knees or hips), and thus target fewer muscles, and in turn involve fewer synergists. Furthermore, even those machine exercises with compound movements take almost all stabilization out of the equation, by providing stability for you and restricting the available range of movement. Hence the stabilizers that would be involved in lifting the freeweights are not used in the machine exercise at all.
Why does this matter? For the simple reason that the more motor units that are “recruited” in an exercise, the more that exercise encourages actual muscular development. Furthermore, in real life you need capable synergists and stabilizers to actually lift things and move them around. So freeweights are also much better at producing real, useful strength than machines that don’t accurately simulate the actual effort of lifting something heavy.
This is why exercises like squats and deadlifts are so popular; they don’t simply work your legs, but in some way or another they involve the majority of muscles in your body.
In my personal experience lifting, the difference in results is so large that it is almost absurd. Most people should only use machines if they literally have no other choice.