So how far down the rabbit hole do you want to go, and just how much do you want to spend? At $400, you can likely get a really nice point and shoot. Would it be better than a flagship smartphone? Yes and no.
You specifically mentioned low light and freezing motion. In these aspects, they are probably going to be on par with each other. A P&S camera typically has a larger sensor for better light gathering, but not by much. This will naturally make more of the available light with less sensor noise. On the other hand, modern phones are likely to have larger apertures, letting you gather more light at a lower ISO, which also helps reduce sensor noise. It's easier to make a large aperture on a small lens, and making bigger apertures on bigger lenses gets expensive quick. But back to P&S, the larger sensor and higher quality optics can give you more to work with if you need to edit anything due to having more actual data compared to sensor noise.
If you like AI, then no one beats the phones. You're also likely to get features like image filters and timelapse. The trade-off here is not only do P&S cameras have a more "pure" image, but you get better ergonomics. I.e. A more comfortable grip, physical buttons, optical zoom, and no worry about shutter lag or getting a call just as you are about to take the shot. If you like setting up the shot yourself, you can make adjustments quicker and easier with a dedicated camera.
Price is certainly a factor. It helps to understand that when you are buying a dedicated camera, you are buying it all. When you buy a phone, some of the costs for things like developing the software is recouped by Google et. al. selling your data.
But, what if you had a larger budget, since you also asked about cameras with larger sensors? I'm a Pentax fan and own one of their DSLR's with multiple lenses, so I looked up their P&S camera options. Their current lineup is the Pentax/Ricoh GR III, and there's a few options depending on features and which lens you want (there's two non-zoom variants). They are a pocketable camera, but have APS-C sized sensors with optical image stabilization. That's the same size as most DSLR's before stepping up to full frame sensors, and that's giant compared to phones and mainstream P&S cameras. The lenses are also decently fast f/2.8 apertures. That means they will blow away a phone for low light and action performance. You also get many features not found on mainstream P&S cameras.
The catch is they start at $900 new, and that doesn't include any of the accessories you can get, like an external optical viewfinder, hotshoe flash, lens hood, etc. Those accessories are certainly optional, but that line is like buying into a system, and isn't something you should choose lightly. If you're willing to spend that much and don't mind something bigger that can fit into a small bag, you may as well start looking into a true DSLR and lens. I personally shoot a Pentax K3 mkII (APS-C), which is built like a tank and one of their earlier flagships. That can often be found used in great condition for about $600. Pentax uses sensor based image stabilization, so ANY lens you get for it will retain stabilization (unlike other brands that rely on lens based stabilization). That means you can take advantage of pretty much any k-mount lens from the past 60 years or so with stabilization, letting you save a lot of dough. Plus many just like vintage lenses.
Long story short, you asked if a $400 pocket camera can match a $1000 flagship smartphone for photos. The short answer is they will be closely matched depending on your specific use case and preferences (especially if you want to zoom). Perhaps the secondary question is if a $1,000 smartphone can match a $1,000 camera, in which case the camera wins almost hands down, and you can still have options that fit in your pocket.