Buying used guitar is a risky business unless you are knowledgeable about guitars. If you are planning to buy a used guitar, you must have somebody with you who knows about a guitar. If nobody is available, then this are the things to look when buying used guitar.
Do not pay attention too much on the blemishes as it is normal for a used guitar. You can haggle for the price based on that later on. The first thing you check is the neck. The warped neck is not repairable. Even if it is a bolt-in neck, meaning it is replaceable, it will cost money to replace it.
Check that the guitar neck has not bowed in, meaning too much neck relief. You can see it as if the strings are pulling it towards a bow. There is a high chance that the truss rod is not working. A truss rod is a long piece of metal inside the neck of the guitar, which is primarily used to counteract the force generated by the string tension. Tell the owner to have the neck relief fixed first before you buy it. If it can be fixed fine, otherwise that neck is junk.
If it is an electric guitar, check that the electronics are working. Scratchy knobs are cheap to replace, but a dead pickup costs a lot of money to replace. All the pickup should produce a good sound when you select it using the pickup selector.
Check for cracks that are filled up. Dents and scratches are okay, but crack is a different story. If you see rust on the hardware, run.
Check for high frets. Play all frets and check if there is no dead note. If there are dead notes, ask the owner to level the frets first because fret leveling costs some money.
If this is a vintage and an expensive guitar, you should have it checked if the original parts are still in. Otherwise, it will lose the vintage value of the guitar.