Zend certified PHP/Magento developer

Why does it take so long to execute commands with sudo?

I have a VM running Kali Linux 2021.3. I have only 2 users kali and root. The kali user possesses sudo permissions with a password. When I run a command without sudo permission, it executes fine. But when I execute the same command with sudo permissions, it takes at least more than 20 seconds to prompt me for the password

But when I switch the user to root with su root and run commands, this doesn’t happen. Additionally, programs like python and PHP take longer than usual to get executed.
For example, to start a simple HTTP server with python: python3 -m http.server 8080 also takes more than 20 seconds.

I thought this was a problem with low RAM. So I tried increasing the RAM by 2GB. It still doesn’t work. I did an upgrade with APT recently. I wonder if that’s what caused this issue. My current version is,

uname -a:

Linux kali 5.10.0-kali7-amd64 #1 SMP Debian 5.10.28-1kali1 (2021-04-12) x86_64 GNU/Linux

This is the output of the auth.log when I execute the command with sudo

tail -f /var/log/auth.log
Oct 23 17:21:27 kali sudo:     kali : TTY=pts/3 ; PWD=/home/kali ; USER=root ; COMMAND=/usr/bin/ls
Oct 23 17:21:27 kali sudo: pam_unix(sudo:session): session opened for user root(uid=0) by (uid=1000)
Oct 23 17:21:27 kali sudo: pam_unix(sudo:session): session closed for user root