In a potential energy measurement experiment, why should an object be lifted slowly at a constant velocity?

Lifting a stationary object causes a ‘some’ change in the object’s motion.

You need force to make a ‘change’ in your motion.

Therefore, when you lift an object suddenly, you need not only the weight of the object, but also additional force to accelerate the object.

In the general case, the potential energy can be calculated as:

Potential energy = Weight(=gravity) × Height

In the above formula, ‘weight(=gravity)’ is the minimum force to lift an object.

If the object is accelerated, it will not fit with the above formula because it will require more force than ‘weight’.