Free weights are always better because they engage so many accessory muscles, core, and balance. BUT...
But machine resistance is better than no resistance work, and machine work can help improve your free weight efforts. A prime example is pullups. Lots of people can't do even one. Sad. It indicates that your back muscles are underdeveloped, or you are overweight, or both. BUT if you work on machine pull-downs and machine (assisted) pullups, you can advance get to real pullups. Lat Pulldown vs Pull-ups: Research Reveals Which Is Best
I do both weekly.
Another example: Leg Press vs Squat: 9 Studies Reveal Which Is Best
Again, I do sets of each, weekly. Weakly too. I entirely understand doing barbell squats with a Smith Machine. You don't need a spotter. Still, I'd rather do squats with a spotter anyway, and my leg presses on my own.
The moral of this fitness post is that free weights are better, but anything is better than nothing as long as it is difficult to do. "Difficult" means reaching deep down to what you do not want to do because it is "too hard." That's a bad approach to life.