The problem with a photodiode is ambient light.
That could be daylight and/or mains powered light with 50/60hz AC ripple on it.
A lot of light on the photodiode (a laser), and a low pull up resistor value to just keep the pin LOW could help.
1Megohm seems waaay to high.
Problem with a laser is the setup. Not easy to keep the spot on the photodiode, depending on distance.
A common 3-pin IR sensor and an IR LED have a wide opening angle (easy to setup), while still having a 5mm ⌀ beam.
Try with your IR TV remote, about 5meters away from the TV.
You can angle the remote quite a bit, or be in an angle from the TV.
But a finger between remote and receiver will block reception.
What are you detecting.
Leo..