For anonymous access you can use a dedicated SP Site Collection or a Forms form.
A form in Forms would be the neat way. People would type the data in the form and a Flow could be triggered to write the data in to SharePoint. Thus you isolate the input area from the working area and work on high security level.
A SharePoint Site Collection would need a lot more editing show only the allowed content of the anonymous users.
The explanation for the form settings can be found here
Here is a response from MS Power Users Board, where the Flow workflow is pictured and explained.