Entry fields – Better approach to complete the details in a form?

There are two UX patterns that I have noticed in many applications when it comes to completing details.

  1. Create a new entity or edit an existing one through the sliding panel
    When you click on New, the sliding panel will open.

  2. Opening a new page to enter the details. This is mainly seen in places where there is a need for tabs or there are too many entries to provide.
    enter the description of the image here

What are the scenarios where one would be preferable over the other?
Is it recommended to use the new page pattern if there are more than a certain number of fields to enter the sliding panel?