this might sound trivial, but there are multiple approaches:

# for (theoretically every) Debian, but not every Debian based system:
cat /etc/debian_version 
11.3

# for Debian 10 and prior
hostnamectl|grep Op
  Operating System: Debian GNU/Linux 10 (buster)

# for Debian 11 and higher
lsb_release -d
Description:	Debian GNU/Linux 11 (bullseye)

# get kernel version (sometimes also includes hints to the distribution)
uname -a
Linux hostname 5.4.106-1-pve #1 SMP PVE 5.4.106-1 (Fri, 19 Mar 2021 11:08:47 +0100) x86_64 GNU/Linux

# yes Debian is running conservative mode on kernel updates
# it has it's pros and cons
uname -a
Linux hostname 5.10.0-14-amd64 #1 SMP Debian 5.10.113-1 (2022-04-29) x86_64 GNU/Linux
admin