Knee pain while performing lunges can be from two reasons: incorrect form and muscle imbalance. When you take a step forward to get into the pose, your knee can naturally push forward. But if your hip muscles s are weak, your knee can move beyond your toes, which adds too much pressure on them. To correct this, you must focus on strengthening your glutes.
Alternative: Perform static lunges, where you do not need to move your legs. It is a basic lunge, where you have to start with your feet staggered, one in front of the other and have to just bend your legs to lower your body. Or better, try reverse lunge which will not put stress on your knees.