Whenever you purchase a used device you should always perform a clean install of the OS. A clean install involves first erasing the whole physical SSD (Intel Macs only) followed by installing macOS. On an Intel Mac only.....while booted into Recovery Mode (Command + R) or Internet Recovery Mode (Command + Option + R)....within Disk Utility click "View" and select "Show All Devices" so the physical SSD appears on the left pane of Disk Utility. Erase the whole physical SSD as GUID partition and APFS (top option). Once erased, quit Disk Utility and select the "Install macOS" option.
Here is an Apple article as well:
Use Disk Utility to erase an Intel-based Mac - Apple Support
For people with an Apple Silicon Mac, follow the instructions in this Apple article to erase the SSD for the clean install:
Use Disk Utility to erase a Mac with Apple silicon - Apple Support