Don't do it. Use a Virtual Machine instead which will at the very least allow you to learn Linux as safely as possible on this computer. People who dual boot their systems usually end up making them unbootable and sometimes even lose access to their data on the macOS volume. Only after you become familiar with Linux should you even consider attempting to dual boot the computer and even then I highly recommend installing Linux onto an external USB drive in order to minimize the risk to macOS and your data.
What exact model computer do you have? Until very recently Linux hasn't had the necessary drivers to work with a USB-C Apple laptop (no keyboard or trackpad support) and no support for the T2 security chip in 2018+ systems (so no access to the internal SSD). The current Ubuntu may have some partial hardware support for non-T2 Apple laptops, but I am not certain (like I said the Linux kernel only got the driver support with kernel version 5.4 or 5.5).
If you want to install Linux directly to bare metal hardware of a laptop, then start by using a spare laptop or an older laptop so if something goes wrong you still have your main laptop working just fine.
Dual booting is a pain and is always dangerous regardless of the OS. People always choose the wrong partition size and run out of room somewhere. For most things a VM should be sufficient and is much safer and is much less disruptive than dual booting.
If you decide not to heed my prior warnings, then make sure to have good verified working backups since the odds are you will be erasing the whole drive and starting over again at some point. Best to be prepared.