Slimes are a strange sort of monster with a strange set of rules.
First of all, when your world is generated, Slime spawning is ‘attached’ to particular chunks of it- a chunk being a section of world sixteen blocks long and sixteen blocks wide (the World, Nether, and End are all created in chunks). Within those chunks, slimes will spawn within the lowest 40 blocks of space wherever they are able, no matter whether or not the space is in light or darkness. This makes them the only monster that will spawn in the light in the whole of the World.
Slimes occur naturally in three sizes- Tiny (less than one block), Small (slightly larger than a single block), and Big (a bit more than two blocks to a side)- and are cubical green masses with a sort of a vague face shape on each side. Slimes move by bouncing, and can hop up and down single-block ‘steps’ just as a player would by jumping. They are also, interestingly, able to climb ladders. If you are within 16 blocks of a Slime in any direction, they will hop towards you- even if they shouldn’t be able to see you. The rest of the time they just hop forwards- whichever direction that is.
Only the two larger sizes of slime are capable of hurting you- though the smallest size of slime can still push you around when it hops at you. Curiously, the two larger sizes of slime don’t drop anything- they instead each break into two Slimes of the next size down. Of course, the smallest Slimes drop a valuable resource- slimeballs. The sticky substance is used for a few bits of advanced crafting that make it quite valuable- and since each Tiny Slime provides up to two slimeballs, a large Slime is a big source of materials.
Although they are tough, Slimes are not very dangerous in most situations, because they do not hit very hard. The pushing can be very hazardous, though, if there is lava nearby (which there often is that deeply underground). With a decent amount of care, though, Slimes can be handled with very little danger. Amusingly, since tiny Slimes do not do any damage and only push the player, they can be effectively kept as a sort of pet, bouncing around near you as you go about whatever you’re doing.
Because slimes can spawn in light, many players have developed ‘slime farms’; underground well-lit rooms (likely lined with fire) where slimes will spawn and then be killed either by the environment or the player to generate slimeballs. A good aid to this is the fact that the slimeballs that slimes drop are very resistant to fire, which means that surrounding them with flame can provide easy and relatively safe harvesting of the slimes.