GEEKY ANSWER - you have been warned.
There's much more to the image quality than just lens and megapixels.
The most important factor in any photograph is:
You can have the best camera and lens in the universe - and that will still be meaningless if you have no light, or very badly lit subject.
After that comes... lens. Lens is what bends the light, what allows you to grab more - or less of it. Your sensor can capture only as much details and light as your lens will let through.
Then you have camera... but there's much more to the sensor than just resolution - sensor dynamic range, color reproduction, noise, and much much more along with how these characteristics change depending on a sensitivity very much determine image quality. Smartphones are very difficult to judge in terms of image quality, but general rule is relatively simple: bigger sensor is better. Bigger sensor behind brighter lens is much better ;).
And finally, a factor to combine them all, and the once deciding if you're photograph will be poor or brilliant:
Even if you have the best gear in a world, and best lighting one could imagine - you will still make poor photos or none at all if you don't know how to approach subject. Cameras these days offer automatic modes, some are even limited to the automatic modes alone, but you are still the one holding and pointing the camera, choosing perspective, affecting environment around - you can try getting more light in, or dim it down, you are the one in control and ultimately deciding on the outcome.
Less-geeky-answer:
If you want good photos without being bothered much - buy yourself a large-sensor compact (eg. Sony RX100 - you can grab one relatively cheaply off eBay) - they tend to be small enough to fit in a jeans pocket and offer very high quality comparing to any smartphone. If you really need something that you can have with you all the time - buy one of the photo-oriented smartphones, you can find good image quality rankings and reviews of a smartphones on a following websites:
Don't look at the number of megapixels - look how it scores in image quality ratings. Oh, and in general - get more light. ;) Sometimes it's simply so dark that you can't take a good photos with the gear you own - just move on, don't get frustrated by this, simply: learn to shoot when the light is great - and then you can try approaching more difficult subjects :).