PHP – Implement AJAX to retrieve pages or posts in a custom WordPress design

I like using Ajax to get the content of a WordPress page in my custom templates. I have read that it is necessary to forward the entire call to retrieve or retrieve data about admin-ajax.php from WordPress. I am a bit confused as to how to proceed. For example, if I want to retrieve the content of a post because I want to display it, I need to set up a call to admin ajax or a call to a function file that contains the post content. PHP Query? Someone leads me.

Sorry for the stupid question, I've never used Ajax in my custom themes or in WordPress in general.
first I try to use that get_template_part() Function to load custom HTML code and WP loops, but not suitable for certain themes or app themes where Ajax is smoother and more user-friendly.

An example of my code:

// here fetch the content inside a div instead of using the loop directly

Is the REST API a good approach?