It really takes a while to correctly perform a squat. An extra set of eyes is helpful too. In addition to not letting the knee go past the toe, keep the weight in your heels and not allow it to shift forward.
Ideally, I should be able to place my fingers under the toes of your shoe and you wouldn't step on them with much weight during the phases of the squat. When coming back up, make sure again that you use glute strength to push back up. The glutes are recruited more effectively when you are settling into your heels.
Lunges were more difficult for me to master than squats. I do have osteoarthritis under my knees. I found that backward lunges were easier first then I could begin to lunge forward. It took me a little time to build the quad and hamstring strength as well as core strength in stability to execute the move. Just practice. You'll get it.
If you have arthritis or a known knee injury you may consider doing prone jackknifes or hamstring curls on the swiss ball. Not a complete substitute but a good thing to have in your rotation if you are experiencing knee pain on a particular day.