Do you mean the one you are on or one that you mabe looking at on the water a a few hundred feet from you? If one you are on, lots of ways: rope length, walk the deck, etc.
One the water is more tricky. You could guess that most sailboats moderate sized sailboats 26 - 45 ft in length have about a 7.5 to 8.5 foot cockpit. From there , guesstimate how many cockpit lengths the boat is and you should be within 2 or 3 feet. This is very general.
Other tell-tales. Ketches and yawls are typically bigger than 34 feet. Same thing with Cutters. If you see one of those, start from the 34+ range.