There are several sources you can look at for correspondences and substitutions, but it depends on the tradition you adhere to.
As mentioned in the other replies here, ideally you need to understand why a specific ingredient is being used in a ritual. However, my guess is that if you are asking this question, you are not yet at a stage in your journey where you have the knowledge to make such changes or to find the specific information needed to do so.
So, my suggestion is to look at some of the many tables of correspondences you can find online and in books, especially those related to the tradition you follow, and experiment.
One common approach is to use planetary correspondences: you replace an ingredient associated with a specific planetary sphere with another ingredient associated with the same sphere.
Another approach is to replace it based on its function. For example, if you are doing a love ritual and can’t find a particular love herb, you could substitute it with another ingredient that is also commonly used in love spells.
You can look at books such as The Encyclopedia of Magical Herbs by Scott Cunningham, Liber 777 by Crowley, or Stephen Skinner’s The Complete Magician’s Tables.
Alternatively, you can look into hoodoo books, which often have tables of correspondences organized by purpose (love, money, etc.), such as Catherine Yronwode’s Hoodoo Herb and Root Magic.