How to properly remove a Linux partition without messing up your drive?
I assume you have Linux installed in the Microsoft Basic Data partition. Although with Ubuntu 18, I would expect a Linux Filesystem partition type.

The command given below will remove the Microsoft Basic Data partition. The created free space will not appear in diskutil list.

sudo diskutil eraseVolume free none disk0s3


The command given below will add the free space to the APFS container partition. This added space will be available to macOS.

sudo diskutil apfs resizeContainer disk0s2 0


I suppose there will still be some Linux code in the hidden EFI partition. The commands below will remove any Linux code that would cause an icon to appear in the Startup Manager.

sudo diskutil mount disk0s1
rm -R /Volumes/EFI/EFI/Boot
sudo disktuil unmount disk0s1