Order of creation/destruction of the related resources

Suppose resource A depends on resource B.
Now when A and B need to be created - all clear. First B, then A.
Similarly when both need to be destroyed - first A, then B.
My question is about modifications and replacements.

  1. A and B are modified. Is it B then A? Or A then B?
  2. B is replaced, A is modified. Is it destroy B, create B, modify A? But would it not be problematic to destroy B in the first place if A depends on it? How does terraform handle it?