Slacks: casual trousers (slacks are not worn with a suit and tie).
Pants: a pair of trousers
Pants can be either casual or formal. If they are formal, you can wear them as part of a suit (men) or pant suit (women).
A suit or pant suit is (a) pants and (b) a matching pant coat.
Note: "pant" is singular, but we rarely say it; we almost always say "pants" or "pair of pants." And when we say a "pair of pants," we are talking about only one (not two) pants.
I have three pairs of pants in my car. One is green. One is blue. The other is brown.
We can also say "pairs of slacks" in the same way.
The younger generation (30 and under) may not use the word "slacks."