How do I check if an object is touching another object?

How do I check if the player is touching any object?

What I am trying to do is make it so I can jump if I am touching anything.

Use a collider on both objects. Also tag the objects, for example one could be “floor” and the other “player”. Then use the OnCollisionEnter function to act accordingly if certain objects collide.

for example if you want to be able to jump if your players touch on anything:

void OnCollisionEnter (Collider other) 
	{
		canJump = true;
	}

void OnCollisionExit (Collider other) 
	{
		canJump = false;
	}

then in your player script, enable the player to jump only if canJump is true.

Whether if the Player using a CharacterController, you can use this method instead and insert the script to the Player Object.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class FinishLineFloorScript : MonoBehaviour
{
    private bool canJump;
    
    // Character Controller : Component
    void OnControllerColliderHit(ControllerColliderHit hit)
    {
        // Check Whether The Object Name Is Being Hit By Character Controller's Collision / Collider.
        if (hit.gameObject.name == "FinishLineFloor" /* <- Make Sure To Change This To Your Own GameObject's Name */)
        {
            // We Print Out Whether The Hit Is Being Touched
            Debug.Log("It Worked");
            
            // For Jump Method
            canJump = true;
        }
    }
}

The Original Link → Unity - Scripting API: CharacterController.OnControllerColliderHit(ControllerColliderHit)