5v USB and Vbattery selection for LDO input

Like I wrote on post#3, you need very low dropout regulator. Like this:
https://www.mouser.it/datasheet/2/760/TOSL_S_A0011435128_1-2575082.pdf


please check my new reply if my LDO doesn't perfrom as expected then i will move to the new one which you give

LDO is giving 0V at Vout when Vin is 3V?

The test conditions clearly state that Vin = Vout + 1.5V
So to meet the specified parameters the input must be at least 4.8V

I don't know your expectations.
I expect that your setup might work reliably when battery is fully charged and less reliably when at lower charge.
Depends also on specific board, Esp chip might work at lower voltages, but flash chip might need higher.
All together, quite gray zone...

It means LDO failed for 3.7v battery to 3.3v for esp32?

3.3V LDO will not perform when Battery input is 3.2 or 3V. I am still confused what LDO will provide at Vout at 3v Input

Correct

It's undocumented since it's out of regulation zone. Can be whatever.

Don't edit you past after I have already replied, it gets confusing

That LDO just will not work with a 3.7V battery.

What it will output at 3V is irrelevant since it will not be in regulation

what can be a good solution for protecting ESP32 from higher voltage than 3.3V
first i know is zener diode of 3.3V
or clamping with Schottky diodes
Any other commonly used method?

Protection is not the issue. You need to provide it with a regulated voltage over the required current range.

You need to read and understand the data sheets for every component you are using.
Have you read the ESP32 datasheet? Do you understand the power requirements?

You are not after protection circuit but after voltage regulation.
The LDO I linked gives you regulation from 4.2V down to ~3.4V. at that point battery is already pretty much drained, below 20%.

But I still suggest you to go with Esp board with buit in battery management!

How do those boards deal with Lipo power? Do they use something like that Torex LDO when on battery power, or something else?

We've been all through this once before. Did you forget?

Depends on board, there are hundreds with lithium battery management. Torex LDO, you mean like the one I linked on post#21? Yes, together with battery management chip.