The primary difference between free weights and machines is the fact that when using free weights, you can move in three dimensions: forward, backward, horizontally, and vertically. This is important, because this is how your body normally moves in daily life.
When you use free weights, you therefore end up engaging more muscles, as you have to work to stabilize the weight while lifting it. The drawback is that you’re at an increased risk of injury unless you maintain proper form.
Machines, on the other hand, are fixed to an axis that will only allow you to move in one or two planes. If used exclusively, this could lead to a lack of functional fitness.
Simply stepping off the sidewalk could result in a knee or ankle injury if stabilizing muscles have been ignored in favor of only working your larger muscle groups. On the upside, a machine will allow you to lift heavier weights, and allow you to target specific muscle groups.
The best is a blend of both worlds to work along with your goals.