To measure the diameter of a screw, measure the distance between the outer sides of the threads.
To measure the length of the screw, start from just underneath the head to the tip of the screw. If you want to measure the thread length, simply measure the start and end point of the threads – this will be different to the screw length if the screw isn’t fully threaded.