Unity's modern Input System supports keyboard, mouse, gamepad and more.

using UnityEngine.InputSystem;

Keyboard:

if (Keyboard.current.spaceKey.wasPressedThisFrame)
{
    Jump();
}

Mouse:

if (Mouse.current.leftButton.wasPressedThisFrame)
{
    Attack();
}

For larger projects, prefer Input Actions and PlayerInput.