I wonder if you really want McNemar's test (more specifically the McNemar-Bowker test). These are tests to see if the marginal proportions are the same (see here). Under the assumption that pairings can be recovered from the orders of the two vectors, here is a table of your data with the marginal proportions computed:
bef = c(4, 3, 4, 5, 4, 4, 4, 5, 3)
aft = c(5, 4, 3, 5, 5, 4, 5, 5, 4)
table(bef, aft)
# aft
# bef 3 4 5
# 3 0 2 0
# 4 1 1 3
# 5 0 0 2
table(bef)/sum(table(bef))
# bef
# 3 4 5
# 0.2222222 0.5555556 0.2222222
table(aft)/sum(table(aft))
# aft
# 3 4 5
# 0.1111111 0.3333333 0.5555556
Since you state that your variables are ordered, it seems more appropriate to assess if one set has higher values than the other. That would use the Wilcoxon signed rank test:
wilcox.test(bef, aft, paired=TRUE)
# Wilcoxon signed rank test with continuity correction
#
# data: bef and aft
# V = 3.5, p-value = 0.1294
# alternative hypothesis: true location shift is not equal to 0
Because you have ties, you cannot use the exact version of the test; you use the asymptotic approximation. If that bothers you due to the small sample size, you could simulate the null and compute the p-value that way. There are different ways to do that, but I'm not sure how much difference they will make in practice. Bootstrapping is generally not recommended with small samples. You could try a permutation-based version, or you could do a Monte-Carlo simulation of the null based on the marginal distribution of the values (ignoring timepoint).