Power a rail to 3.3 volt by 3.3v - 5v input

Hello I have a delimma where i must power a rail to 3.3 volts, and the input can be from 3.3v to 5v. My problem lies in when the input is 3.3-3.5v because the 3volt regulator i am using will drop 0.3v meaning that at 3.3v volt input will drop to 3.0v.

I had an idea to place a bypass diode but the problem is now reversed because any input above 3.5v will bypass to the rail.

schematic

Has anybody encountered this problem ? Any tips?

You can't use the diode for the reason you stated. Your regulator will work down to a dropout voltage of 125mV at 300mA, and even less at lower currents, which would be an input of 3.425V in the worst case. Below that, it will probably just pass through what comes in, but you would have to test that. I don't know where you got the .3V dropout figure. I would bet this regulator will work ok.

Many circuits will have a boost converter and then a voltage regulator (3.3V).
See if this would work for you