There are several factors to consider here. Some of them point in the direction of one of the lenses you are considering, other factors point in the direction of the other lens.
Although there are exceptions, in the vast majority of cases zoom lenses, particularly those with very wide angles of view, are best at their widest/shortest focal length. Roger Cicala, the founder and chief lens guru at lensrentals.com, did a blog post about it titled: Painting Zoom Lenses with a Broad Brush – Roger’s Law of Wide Zoom Relativity.
But there is also something to be said about zoom lenses with larger or smaller zoom ratios. An 18-140mm lens has a zoom ratio of 7.78. A 10-20mm lens has a zoom ratio of 2.0. In general, zoom lenses with a lower ratio between the two extremes in focal length can be made to give better optical image quality than those with a very wide range between the ends of the focal length range. Normally the biggest compromises of wide ratio zoom lenses are made at the extremes of the zoom range.
There's also the consideration that an 18-140mm lens must begin with a retrofocus design and at some point transition to a telephoto design. This means more moving groups of lens elements that must move towards or away from each other as the lens is zoomed in or out. That's a lot of complex lens mechanics that need to be executed with a high degree of precision.
From the comments to an answer to this question: When you zoom in with a lens on an SLR why does the lens go in then out?
These lenses are often telephoto at the other end as well (as opposed to merely being long), and will be neither retrofocus nor telephoto at some point in the transformation (that is, the optical center of the lens will be at the actual focal length). So, at the shortest focal length, the front group is divergent and the rear convergent, at the longest the front is convergent and the rear divergent, and in the middle the whole thing acts as a single, complex convergent lens. That's a lot of parts shifting around. -user2719
From two other users:
Mmm... interesting. Do you have an example of a design that achieves that?
Can you explain how this switching from retrofocus to telephoto works, and why and how it affects the lens extension?
user2719's reply:
It's actually more than four independent groups in real life (especially if image stabilisation is involved) and no, it's not "overly complex". The transition from telephoto to retrofocal configuration can be explained by the relative movement of a single group in the simplest possible design -- the shifting of a convergent group between front and rear divergent groups, making the front and rear "group of groups" relatively more or less convergent/divergent. It's really a pretty elegant concept.
The "simplest possible design" is not optically the best design. Rather than moving a central "supergroup" in relation to two fixed divergent elements/groups, it's the divergent elements that move in relation to the convergent supergroup. When the front divergent element is farthest from the center, you are at the shortest focal length. Conversely, when the rear divergent element is farthest away, you are at the longest. When the lens is at its most compact, it acts as a simple multi-group lens (neither retro nor tele). The central supergroup itself may be varifocal.
A 10-20mm lens, on the other hand, can remain a retrofocus design all the way from 10-20mm for the Nikon F mount that has a registration distance of 46.5mm.
Both of these lenses are in the 'consumer grade' category and are fairly inexpensive for their respective classes. Neither should be expected to be world beaters, particularly at 20mm focal length which is the long extreme for the 10-20mm and right at the short extreme for the 18-140mm.
In the end, comparing two lenses as disparate as an 18-140mm lens and a 10-20mm lens to see which performs better at 20mm should rely primarily on direct observation of how each performs at 20mm under what are otherwise identical conditions (same camera, same scene, same shooting distance, etc.) to how you plan to use whichever lens you wind up choosing. Unfortunately, the AF-P DX 10-20mm f/4.5-5.6G VR is fairly new and hasn't yet been lab-tested by a lot of the most popular sites such as DxO Mark or Imaging Resource.
Based on the published field test of the 10-20mm at IR and several reviews of the older 18-140mm I'd say it is probably a tossup, and may even vary from one to the other depending on the specific examples of each of the two lenses and how each one falls within the manufacturing tolerances of each lens model. In other words, the sample variation within different copies of either lens may well be greater than the difference between a typical sample of the 10-20mm compared to the 18-140mm at 20mm.
Should I invest on wide angle lens if I really don't need to go below 20mm zoom.
Even if the 10-20mm is marginally better than your 18-140mm, the thing you need to ask yourself is how much are you willing to pay for that marginal improvement? Unless you are also planning on using the 10-20mm for wider angles of view than you can get with your 18-140mm I'd say that is a lot to spend for not much difference.