The kernel is universally detected with 'uname':
$ uname -or
2.6.18-128.el5 GNU/Linux
There really isn't a cross-distribution way to determine what distribution and version you're on. There are attempts to make this consistent, but it ultimately varies, unfortunately. LSB tools provide this information, but ironically aren't installed by default everywhere. Example on an Ubuntu 9.04 system with the lsb-release package installed:
$ lsb_release -irc
Distributor ID: Ubuntu
Release: 9.04
Codename: jaunty
Otherwise, the closest widely-available method is checking "/etc/something-release" files. These are common on most of the common platforms, or on their derivatives (ie Red Hat and CentOS).