Force is classified broadly as contact forces and non-contact forces.
The force functions when two bodies come into physical at the point of contact are called contact forces.
Non-contact force is that action that acts between objects which are not in physical contact.
For example when a ball is thrown upward combination of contact and non-contact forces act on it. Hands that push the ball upward are in contact with the ball. The force applied by hands which are called muscular force is a contact force. While rolling in air ball overcomes resistance applied by the air which is known as frictional force. Air is in contact with the surface of the ball, hence friction is a contact force.
Once the ball attains zero final velocity and falls back to the ground, a gravitational force acts on it. Earth attracts all falling objects towards it without being in contact. Hence, the gravitational force is a non-contact force.
Explanation
Non-contact forces act on objects without actually touching objects.
Magnetic force is a non-contact force hence creating a magnetic field around the magnet, that attracts objects from distance.