How to Reindex prices by product ids programmatically Magento 2?

You can reindex only prices for the products in Magento 2 store by their ids.

Indexer id used for the prices is catalog_product_price. We need to reindex only prices programmatically to reflect the price changes on the backend. you can do it using CLI command also,
php bin/magento indexer:reindex catalog_product_price

Using code, check the demo,

Call method with required ids,