A preface is an element that is found the front matter of a book that is written by the author of the work. A foreword is an element that is used in the front matter of a book that is written by someone other than the author. These are generally used in non-fiction works.
Generally, a preface should tell the readers why the book was written and also tell them how the author is qualified to write the book. I always thought it was important for a publisher to remind an author to keep the preface short. In many cases the reader will be more concerned with the central part of the book that begins after the front matter. If you want people to read the preface, keep it short and there is a chance it might be read. If it is more than a few hundred words, it is likely to be skipped by the reader.
The Foreword should tell the reader why the book was written and discuss the author’s qualifications or if the book was written by editors give the reader some idea of the source of the information. In some cases, a foreword is written by someone who is a celebrity. Some publishers use the foreword as a kind of an endorsement. In some cases the writer of the foreword spouts poetically about their own talents. Often, the foreword comes across as a means for the foreword writer to brag about himself or herself. This is a bad use of a foreword and in my opinion, a waste of time.
Some publishers use a foreword or a preface as an all-purpose document that includes an introduction to the book, acknowledgments, and an about the author. I am in favor of having the elements speak for themselves as they were originally intended. On a very short work thought such an element can be useful in keeping the pages and costs down. Some publishers like to have a document upfront that they call an introduction that jumps starts the book for the reader. This can be helpful if the content needs an introduction if the publisher and the author want the chapters to maintain more strict content. For example, if you have a book on the fifty states, an introduction might include information that covers material on certain regions or broader areas so the chapters have a better focus.
On some of the more complex books that I worked on that were used to educate people I sometimes included a first chapter that was a kind of executive summary of the entire book. We took smaller sections of each chapter and rewrote them for a quick understanding of the subjects right at the start before each chapter would offer much detail. This was also an excellent way to tell the book creator if there were any logical holes in the work and helped us make the book much better. It was also possible business that the book was going to people who dealt with the subject in different ways. The executive summary helped insure that all readers could benefit by reading the book, even if some only read the first chapter.