Software based issue

Friends I am having a issue whenever I am using my system after some time touch pad button doesn't work trackpad is working properly but whenever I tap I doesn't get response then I have to restart then I works properly and after some time same issue again
And right click or left click is not even working with external mouse I think It a. Software based error

Please check if the driver is installed:

sudo apt install -y xserver-xorg-input-libinput

It was already installed

Still sounds like libinput error...
Can you check if xserver-xorg-input-synaptics is installed, and if so, please remove it

sudo apt remove --purge xserver-xorg-input-synaptics

Reboot and test. If still no good:

If the touchpad stops working after some minutes of the computer sitting unused, it may be power management that is disabling it.
Find your device with

cat /proc/bus/input/devices

Look for a line that may resemble the following... it is the Sys and the /power/control that you are looking for.
I am using a Tower PC, not a notebook, so I cannot copy mine in a way that will look exactly like yours... but, my optical mouse:

Sysfs=/devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2.2/1-2.2:1.1/0003:093A:2533.0004/input//power/control

Disable it with by replacing the path in this example with the one you found in cat /proc/bus/input/devices

echo on | sudo tee Sysfs=/devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2.2/1-2.2:1.1/0003:093A:2533.0004/input//power/control

Reboot and test.

Thanks for your help. Bro can you give your insta id