How to determine if electrical wires (romex) are undersized?
Look at the cable or wire.  Any cable or wire legal to use in the US must be labeled at regular intervals.  There's usually a lot of gibberish but amongst it will be something like 10 AWG  or 8 AWG or 6 AWG. 

You should also double-check to see if the wire is copper or aluminum.  Look at the ends at the bare wire. Copper is the color of a penny.  Aluminum is the color of a nickel.  Aluminum wiring may also have markings like AL or AA-8000 or AA-1350.  The AA-1300 series alloys are illegal for new work and widely considered dangerous.  The AA-8000 series are legal but must be terminated in a special way.  



The allowable circuit breaker size is defined by the size of the wire.  It's fairly simple: 


14 AWG copper wire -- 15 amp breaker
12 AWG copper wire -- 20 amp breaker
10 AWG copper wire -- 30 amp breaker
8 AWG copper wire -- 40 amp breaker
6 AWG copper wire -- 50 amp breaker (higher in some cases)


(the pattern is not linear after this, it is also different for aluminum.)  You cannot use a larger (more amps) breaker than the wire can support. Smaller is OK.  

So step 1 look at your wire.  Step 2 check your breaker.  If your breaker is not allowed for the wire, turn the breaker OFF until you change it to the value allowed for the wire.   Don't delay, shortcut or fool around.  Do it right away.  At this point the circuit is safe from overload. 



Now that you know the allowed amps on the circuit, and have replaced the breaker to that value, it's time to look at the receptacle.  Here's the table right out of the National Electrical Code. 



Look at your circuit amps, and change your receptacle to one of the allowed sizes.  (by the way, 50A receptacles are allowed on 40A circuits because there's no such thing as a 40A receptacle. If it ever did exist, code would allow it, but it doesn't. That's because there's already a glut of receptacle sizes, we don't need another.) 

Your fixed wiring is now legal, in a safety sense. (it may not be provisioning the circuits that Code requires for new construction, but it won't burn your house down.) 



Now, let's look at distance. All wires have resistive losses at high loads.  The loss is "per-foot", and the above steps have made sure the loss is small enough per foot that nothing will get dangerously hot, regardless of the length. 

But on a longer run, this can add up to significant voltage drop - the appliance may not get as much voltage as it wants, which can result in poor performance. 

You can compensate for that by using larger wire.  Here is a calculator to help you work that out.    This is rarely needed in within-the-house wiring; it would have to be a pretty big house. 



The next step is to figure out if your devices can work with that amount of power.  I generally assume that previous people who worked on a circuit had a "method to their madness" and didn't do random stupid things.  You may find your appliances are able to work with circuits of that ampacity - check the documentation and/or with the manufacturer.  

For instance it's very common to have ranges which actually work fine on 40A, but are supplied with a 50A plug for reasons discussed above. 

Or this may be a replacement appliance, and the original one did work with that ampacity.  In which case you'll be able to find other appliances which will work.  This is likely cheaper than pulling new cable.  

Or you may be able to adapt your use of appliances so you can stay within circuit limits.  This may or may not be legal.  For instance if your heat pump has a multi-stage auxiliary heat system, you may be able to disable one of the stages.