As suggested by Greg Nuckols, it is important for beginners to focus on learning how to perform compound movements correctly, and lifting to failure typically results in form breakdown that would interfere with this.
For example, while you are learning how to squat, squats should likely not be taken to failure, and each rep should be done with good form. However, you could add in less complex movements as assistance work, such as leg press and hamstring curls, and take them to failure to maximally stimulate leg muscle growth while you learn to squat correctly.
Training to complete failure likely isn’t necessary to maximize growth – you can likely leave a couple reps in the tank. Unfortunately, people aren’t very good at knowing how close to failure they actually are. Taking a set to failure “idiot-proofs” it to make sure you maximized the stimulus.