Can i disable a function in another script?

Idk how to explain, i made a button that pauses the game (left top corner) its working good but the problem is that when i touch that button, my player object also gets the touch input for his script(its jumping)
Here is my player script :

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;

public class Player : MonoBehaviour
{
    public Rigidbody2D rb;
   
    public int health=1;

   
    public GameObject gameOver;
    public Animator anim;



    void Start()
    {
        rb = GetComponent<Rigidbody2D>();
        anim = GetComponent<Animator>();
    }
    


    void Update()
    {
        
        if (health <= 0)
        {
            gameOver.SetActive(true);
            Destroy(gameObject);
        }

        if (health == 1)
        {
            anim.Play("Player1");
        }
        else if (health==2)
        {
            anim.Play("Player_shield");
        }
        
            if (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Began || Input.GetMouseButton(0))
            {

                anim.SetFloat("runMultiplier", 1f);

                rb.velocity = new Vector2(rb.velocity.x, 7);
                rb.velocity = new Vector2(rb.velocity.x, 7);

            }
            else
            {
                
                anim.SetFloat("runMultiplier", 0.7f);
            }
        
        
    }

   
}

and here is my pause button script :

using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    using UnityEngine.SceneManagement;
    using UnityEngine.UI;
    public class PauseButton : MonoBehaviour
    {
        public GameObject PauseMenuUI;
       
        public void Pause()
        {
       
            PauseMenuUI.SetActive(true);
            Time.timeScale = 0f;
            
        }
    }

So when i press the pause button, the player also jumps and when i exit the pause menu it is going up(continues the movement input), i thought about disabling the update function on player whenever i press the pause button, but i dont know how and not sure if itll work. Can you give me some tips?
Thank you!

Hello.

You dont need to disable anything.

Just need to be sure at the touch function to be sure you are not touching a UI element. something with this structure:

if (Input touch)
 {
  if (Touching UI)
  {
  nothing (or not)
  }
  else
  {
  Jump
  }
}

Check this post: https://answers.unity.com/questions/1115464/ispointerovergameobject-not-working-with-touch-inp.html?_ga=2.70265235.20869102.1582893140-1660236971.1528636420

Bye!

Thanks, i found this function
using UnityEngine.EventSystems;

/// <summary>
/// Checks if the pointer, or any touch is over (Raycastable) UI.
/// WARNING: ONLY WORKS RELIABLY IF IN LateUpdate/LateTickable!
/// </summary>
private bool IsPointerOverUIObject()
{
    if (EventSystem.current.IsPointerOverGameObject())
        return true;
 
    for (int touchIndex = 0; touchIndex < Input.touchCount; touchIndex++)
    {
        Touch touch = Input.GetTouch(touchIndex);
        if (EventSystem.current.IsPointerOverGameObject(touch.fingerId))
            return true;
    }
 
    return false;
}

its checking if its an UI touched and it`s working with this, ty.