Hi Jim, it sounds like your X axis optical sensor is not working properly, or at least only working intermittently.
The K40 lasers are not known for using high quality parts, so a failing/ failed optical sensor is not at all surprising.
If you could provide some photos of your board, wiring, and sensor that may help diagnose the issue you are having.
You can also try to test your endstops by following this guide:
If you can do the M119 test it should allow you to check your endstop and see if it doesn’t work at all, or only works sometimes. If it only works sometimes it could be the result of a loose connection or a failing sensor. If it has failed (or only works sometimes) you might want to consider replacing it with a mechanical switch endstop, as they are typically easier to use.
We should also mention, the LaserBoard should not be capable of damaging a functional optical sensor. If connected properly the sensor receives 5V from the board and returns a signal when triggered. The board relies on the optical sensor working correctly to control the movement of the laser. If the sensor fails, it cannot tell the board when movement should stop.