Yes Portuguese custard tarts need to be refrigerated if you're not eating them or serving them the same day of purchase or making them.
You can leave the Portuguese custard tarts out at room temperature if you're serving them the same day or eating them the same day and they will be fine.
But if you buy or make Portuguese custard tarts and are not gonna eat them until the next day or so then always refrigerate them.
If you leave them out overnight at room temperature the Portuguese custard tarts could grow bacteria on them and cause them to go bad.
That can then make you sick even though you may not see the bacteria on them.
When refrigerated the Portuguese custard tarts should last for up to 3 days.