Need help with ground check when jumping

No guide or anything has been able to help me so far. They keep bringing in new issues that take much more effort to fix. Currently I can jump mid air and I need to fix that. Another issue I have is that it sometimes randomly makes me fly high up into the sky when I press jump, way more than it should.

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

public class Character_jump :  MonoBehaviour
{
    public float jumpforce = 10f;
    Rigidbody rb;

    void Start()
    {
        rb = GetComponent<Rigidbody>();
    }

    void FixedUpdate()
    {
        if (Input.GetKeyDown(KeyCode.Space))
        {
            
            rb.AddForce(Vector3.up * jumpforce, ForceMode.Impulse);

        }

    }


}

You can’t use GetKeyDown in FixedUpdate.

Try this:

	void FixedUpdate()
	{
		if (Input.GetButton("Jump"))
			if (Physics.SphereCast(transform.position,0.5f,-transform.up,out RaycastHit hit,0.51f)) // something below?
				rb.AddForce(Vector3.up*(jumpforce-rb.velocity.y),ForceMode.Impulse);
	}

I don’t know if I have raycast set up and IDK how to do raycast.

Thank you so much, I got it working and now I don’t fly up into the sky and I can now not jump mid-air.