I heard a photographer once say
Cameras come and go, but glass is forever
indicating the lingering value of good camera lenses. Excellent well designed and built lenses stand the test of time while cameras breakdown and become obsolete much more rapidly. Not that lenses can’t go wrong but they can hold their value and usefulness for a very long time if well cared for.
If you are buying a used camera lens here are some things to look for
Mechanical wear and damage
For casual inspection, just try turning the focus and/or zoom rings. Do they move easily and smoothly through their range? Or do they have spots where they catch? Feel tight or loose? Some lenses, even good ones can feel gritty or notchy but generally feel consistent throughout their range.
This needs to be tested on camera obviously. Try every function that the lens has available and see if it is functioning as it should.
Slow, damaged or oily aperture
Look into the lens and see what you see. Oil on the aperture blades will look like a dark ring or little triangles. A flash light can help here. Look through the front and rear of the lens to look for oil. If the lens has a mechanical aperture level, try opening it and letting it snap closed. It should be clean and snappy. Oil can be cleaned but its often a big job. More here…
Deadly to lenses. Fungus looks different from lens to lens but general looks like webs, blobs, pots or lines. Sometimes it can be very hard to see as well so again, use a flash light and look carefully. Shine the light from one end and look indirectly into the other. Careful to not blind yourself
If you see fungus or suspect it keep the lens away from your other camera equipment although since it can spread. An infected lens is just not worth it unless it is very rare or special for some reason. If fully disassembled fungus may be cleanable but it can often damage lens coatings.