The problem is that many investors apply metrics, like P/E or book value, blindly without understanding the assumptions that must be true for the metric to be a meaningful measure of value. It is even more complicated inasmuch as some companies fall into an ambiguous gray area when it comes to appropriate valuation metrics (I'd argue Apple is one such company).
Like with any analysis, there is some work to make sure the statistical model actually captures what you intend to measure.
There are still measures that correlate well with low risk and strong returns for some subset of companies, but identifying a subset and building valuation models for them is non-trivial (e.g. I typically use risk models for revenue growth in comparative valuation which don't even apply to most of the market). If it was as simple as looking at a trivial ratio of public numbers, everyone would already be doing it.
I've been investing a long time and the markets have changed a lot over the decades. At this point, I think most of the investing advice from several decades ago is obsolete because it is based on assumptions that aren't actually true today. Investment advice and heuristics have a shelf-life. Most people aren't going to build a portfolio strategy from first principles, it is a lot of work, hence the popularity of index funds.
This is obviously the core of the issue. But you'd be surprised at how often it is that these concepts surrounding P/E are parrotted constantly at many leading financial firms and schools.
I just wanted to give an example to say that you can check things about a company beyond the stock price, which may be inflated by gambling. If a stock is "gambled" to the moon, it assume would have a very high P/E. I'm not actually an expert on those indicators, haven't looked into them much.