Smith machine is fine if that's what you have access to. The thing is the movements don't translate very well to their freeweight barbell counterpart, so people who have convinced themselves that freeweights are vastly superior in everything have decided that the smith machine is a complete waste of time**. In reality it's just another movement pattern that can be utilized for different situations.
For example a barbell bench press is not actually a vertical motion.
A real bench press has some lateral movement to the full motion. This lateral movement allows muscles to move in a more "natural" way and allows you to engage different muscles at different times.
A smith machine bench press is going to be locked in to the rails. This makes it more akin to a machine press. This means that certain muscles will get worked a lot harder, and others will get worked less. This is not a good or bad thing, but it's something to be aware of. They're different movements.
The same goes for a smith machine squat.
Smith machine squats are usually performed with the feet in the front. This is more similar to a hack squat machine rather than a barbel squat. It's actually very difficult to do parallel with your feet underneath you unless you are very flexible. A lot of people like this version because they feel it's far more targeted on the legs and glutes while being less fatiguing than a barbell squat.
As far as injuries go, I have not seen any actual hard evidence that smith machines are any more or less dangerous than any other movement. Just like anything it's about load management. You should always start with a weight that you can easily manage and slowly build up from there.
For best exercises. This is all personal opinion, but I personally feel the hack squat, shoulder press, and glute bridge work really well on a rail system. Their setup works well for the smith machine, and they target their respective muscle groups. Bench press is probably best done with barbell, dumbbells, or machines as the setup on a smith machine can be harder to do consistently. Sometimes you are further up the bench or further down and it changes the pattern.
** I used to be one of these people.