As you mentioned in the side note, it really depends on the type of pill. Because there are chemical interactions between the food and the pill e.g. tetracycline and milk (tetracycline and calcium form complexes, thus inactivating the antibiotic).
Generally the gastric pH is not so important for the drug uptake, as it happens in the small intestine. However some drugs can get destroyed in acid, therefore some pills have an acid resistant coating.
This coat is usually a weak acid. Since the gastric pH is very low (1-3) weak acids stay protonated, thus are not polar and can't be solved in water. Later in the duodenum the pH varies between 8-9, the coating weak acid deprotonates and dissolves. The drug is set free. This is the reason why you can't split all pills!
The reason why you should eat some food with some medicaments is that they can irritate your gastric lining (e.g. diclofenac) and food serves as a buffer as it "dilutes" the medicament. Other substances need the food to function properly e.g. iron needs to be taken with orange juice or other vitamin c rich juices (the gastric acid oxidates
Fe2+ -> Fe3+, but
Fe3+ cannot be absorbed, therefore vitamin c is needed as a reduction agent).
The question which food is the best can't really be answered as each patient is different. As long as the food does not harm the medication any food you like is good. Usually some crackers are enough, however if you start to feel stomach pain, eating more would be a good idea. Since most medicaments should be taken at a fixed time of the day, taking them 5 minutes after a regular meal is a good idea.
However some food should not be eaten while taking medication because they induce/inhibit the cytochrome P450 system in the liver and therefore leading to insufficent or dangerous high blood levels of the medicamention.
- grapefruit juice induces Cyt P450 3A4 which leads to sometimes greatly increased bioavailability of many medicaments and herbs (and the reverse for a few), and thus overdoses or underdoses.