Straddling the bike with the front brake on, put your other hand on the joint between the fork and steering tube, and rock the bike back and forth. There should not be any play there. If there is play, the headset needs adjustment and maybe service/replacement.
You need to know the type of headset to find the adjustment. Threaded headsets usually require large special wrenches. Non-threaded do not, usually just 4mm and 5 mm Allen keys. Search online.