As far as I understand they are libraries, but what is the difference between the two?
.a file is a static library, while a
.so file is a shared object (dynamic) library similar to a DLL on Windows. There's some detailed information about the differences between the two on this page.
As a follow on, a .a file is an "ar" archive. Not unlike a tar archive, it stores .o or object files, allowing them to be pulled out of the archive, and linked into a program, among other things. You could use ar to store other files if you wanted.
You can get a listing of the members of an ar file with the -t parameter, for instance:
ar -t /usr/lib/libc.a
A .so file is a "shared object" file, and has a lot more information available to the linker so that members can be linked in to a loading program as rapidly as possible.
For instance, try:
objdump -T /lib/libc-2.11.1.so
(or whatever version of libc.so you have in your /lib directory.) Note that a .so file could also just contain a linker script directing it to find the file elsewhere, or use something else.
Interestingly, a .so file can also be a full fledged program. For instance, trying running /lib/libc.so.6. (This works on my Ubuntu 20.04 system)