It's important that you measure yourself correctly in order to compare to the stats presented here! Not all research follows the same methodology though, so pay attention to the details of whichever dataset you're using. If you want to get accurate results, you should use an honest measurement, as if you were a researcher measuring another person. In other words, don't try your hardest to get the maximal dimensions.
Length should be measured using a ruler (or other similar tool, such as a tailor's tape) along the top of your member, pressed comfortably against the pubic pone (bone-pressed)¹. Do not press the ruler below the pubic bone. If you're causing yourself any discomfort, you're overmeasuring yourself.
If by any chance you have strong or moderate curve, you can either gently straighten the curve, use a piece of string that goes along the top following the curve, or disregard the curve completely. Whichever method you choose will inform you about different comparative aspects. Do note that many studies exclude people with penile curvature.
Girth (circumference) can be measured using a tailor's tape, a string, or a strip of paper wrapped around the penis. There is not a clear consensus if it should be measured along the base, along the middle or an average of the two, so feel free to use any of those measurements, but do not measure it along the glans/head.
For erect measurements, your penis should fully hard. For flaccid measurements, it should be completely flaccid and held perpendicular to the body, unaltered from its normal contracted state and without being affected by cold temperatures.
¹ While bone-pressed is the recommended way to measure your length, some datasets may use NBP (non bone-pressed) measurements instead. In these cases, you simply put the ruler against the base of your member. Do not push it into the fat pad or against the pubic bone.