Epilogues tie up loose ends. They are part of the story. Afterwords are separate parts of a book. You can tell the difference because a book can typically stand alone without its afterword, but not an epilogue.